Email out of C#

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.
 
I

Ignacio Machin

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top