Email out of C#

  • Thread starter Thread starter Pkant
  • Start date Start date
P

Pkant

Hi ,
I want to sent an Email out of an C# Programm.
I am using this code :

private void button3_Click(object sender, System.EventArgs e)

{

MailMessage myMail = new MailMessage();


myMail.From = "Torben";

myMail.To = "(e-mail address removed)" ;

myMail.Subject = "HALLO" ;


myMail.BodyFormat = MailFormat.Text ;

myMail.Body = "Moin";

// myMail.Attachments.Add (@"c:\test.txt");

SmtpMail.SmtpServer = "smtp.myserver.com";




SmtpMail.Send(myMail);

}



When I am starting the Program SmtpMail.Send <<<<--- overloaded , and the
email don´t arrive.
 
Hi,

Does SmtpMail.Send( ) throw any exception?
if not the mail was sent , maybe the problem is in the smtp server you are
using, maybe you do not have relaying permission, or maybe your email is
just in the queue to be delivared on a later time.
I would suggest you set the myMail.From to a valid email in such a way that
you can get the error message back.

Hope this help,
 
Back
Top