System.Net.Mail.SmtpClient.Send() Error: An invalid character was found in the mail header.



I've had nothing but trouble from the System.Net.Mail objects, but I
finally need to make them work, and I can't for the life of me see what
I'm doing wrong.

I pared back my mail transaction to the bare minimum:

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("<my
mail server IP>", 25);
smtp.Send("<one of my email addresses>", "<another of my email
addresses>", "Hello", "World");

And on the smtp.Send() command I get back a SmtpException {"Failure
sending mail."}, {An invalid character was found in the mail header.}.

An inspection of the MailMessage object (before I simplified that away)
showed that there were no items in the header before this exception. A
packet trace during the exception shows that the SMTP server responds
properly and the object immediately replys with a "QUIT".

I would greatly appreciate any insight that could be offered.
Thanks,
Andy

.



Relevant Pages

  • Re: Boolean tests [was Re: Attack a sacred Python Cow]
    ... "len!= 0" will get you in trouble if somebody passes a string or a dictionary. ... With the exception of the "is" and "is not" operators, nothing in Python is guaranteed to work with any imaginable object. ... Yes, I know it breaks duck typing, which is why I do it only very rarely, and never with e.g. sequence types. ... If I use ifinstance for type checking, it's because I need some _very_ specific class, almost always one that I wrote. ...
    (comp.lang.python)
  • Re: Larry Update !!!
    ... Larry got bank. ... You know what I take exception to? ... Usenet who are so clearly devoid of a life that they begin to obsess ... When he posted dozens of outlandish statements, ...
    (rec.sport.golf)
  • Re: Boolean tests [was Re: Attack a sacred Python Cow]
    ... "len!= 0" will get you in trouble if somebody passes a string or a dictionary. ... With the exception of the "is" and "is not" operators, nothing in Python is guaranteed to work with any imaginable object. ... Yes, I know it breaks duck typing, which is why I do it only very rarely, and never with e.g. sequence types. ... If I use ifinstance for type checking, it's because I need some _very_ specific class, almost always one that I wrote. ...
    (comp.lang.python)
  • Re: SmtpMail.Send - Exception: "Could not access CDO.Message object"
    ... Jens wrote: ... > The web server and the mail server are two different physical computers. ... Exception has been thrown by the target of an invocation. ... to get the real error message of why the mail wasnt sent like ...
    (microsoft.public.dotnet.framework.aspnet)
  • Error when attaching multiple files (System.web.mail)
    ... I am having some trouble using the MailMessage object to send an email with ... Exception has been thrown by the target of an invocation. ... When a user submits a file, it is stored directly to the database, and when ...
    (microsoft.public.dotnet.framework.aspnet)