Hi Dan,
Are you able to send from that address ("[email protected]") through the
UI? You should try to verify that you own that address first before trying
to send as that user:
https://mail.google.com/support/bin/answer.py?answer=22370
If you can't send as that user through the UI, then you won't be able to do
it through SMTP.
/Rufus
On Fri, Sep 30, 2011 at 11:46 AM, DanH <[email protected]> wrote:
> Hi,
> This is a follow-on to a previous thread, where I was having trouble
> sending mail via smtp.gmail.com. Here is the code which works properly:
>
> SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
> client.EnableSsl = true;
> client.Credentials = new NetworkCredential("[email protected]",
> "password");
> client.Timeout = 5000;
> MailMessage message = new MailMessage();
> message.IsBodyHtml = false;
> message.From = new MailAddress("[email protected]");
> message.To.Add("[email protected]");
> message.Subject = "The Subject";
> message.Body = "this is the body";
> try
> {
> client.Send(message);
> }
> catch (Exception ex) { // do something }
>
>
>
> Except - when the mail arrives, the From is the username passed in as a
> credential, [email protected]. Instead, I want the From to be the
> e-mail address explicitly set as [email protected]. How do I get the
> message.From to be correct? When stepping through the code in the debugger,
> Intellisense reports that message.From is what I want, not what actually
> shows up.
>
> Thanks.
>
> Dan
>
--
Andy "Rufus" Rothfusz | Developer Programs Engineer | Google | Mountain
View, CA
--
You received this message because you are subscribed to the Google Groups
"Google Apps Domain Information and Management APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.