For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > October 2006 > Help - Failure sending email









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help - Failure sending email
NW Technicals

2006-10-31, 7:06 pm

I am trying to send email using this fucntion can you guys help me please
finding the mistake

I am using my Gmail Credentials and the only exception error I get is

Failure sending email

Any help is greatly appreciated

=====================

MailMessage mailMessage = new MailMessage();

try

{

SmtpClient client = new SmtpClient();

client.Host = SMPTPServerTextBox.Text.Trim();

string emailUserName = FromAddressEmailTextBox.Text.Trim();

string emailPassword = EmailPasswordTextBox.Text.Trim();

client.Credentials = new NetworkCredential(emailUserName, emailPassword);

client.EnableSsl = true;

string toAddress = ToAddressEmailTextBox.Text.Trim();

mailMessage.To.Add(new MailAddress(toAddress));

mailMessage.From = new MailAddress(emailUserName);

mailMessage.Subject = SubjectTextBox.Text.Trim();

mailMessage.Body = EmailBodyTextBox.Text.Trim();

client.Send(mailMessage);

EmailResultTextBox.Text = "Successfully Send Email";

// Logger.LogInfo("Successfully Sent Email");

}

catch (Exception ex)

{

EmailResultTextBox.Text = ex.Message;


}



Mark Rae

2006-10-31, 7:06 pm

"NW Technicals" <anonymous@someone.com> wrote in message
news:O9gKNBQ$GHA.1224@TK2MSFTNGP05.phx.gbl...

>I am trying to send email using this fucntion can you guys help me please
> finding the mistake
>
> I am using my Gmail Credentials and the only exception error I get is
>
> Failure sending email
>
> Any help is greatly appreciated


You need to inspect the InnerException. See here for further details:
http://www.systemnetmail.com


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com