I write this code but it doesn't work. It just show "Email didn't send succesfully". I didn't know how to add UserName, Password and Port. Please help me.
private
void Button1_Click(object sender, System.EventArgs e){
Button1.Enabled =
false; try{
System.Web.Mail.MailMessage myMessage =
new System.Web.Mail.MailMessage();myMesage.To = txtDen.Text;
myMesage.From = txtTu.Text;
myMesage.Subject = txtCD.Text;
myMesage.Body = txtCT.Text;
myMesage.Priority = MailPriority.High;
myMesage.BodyFormat = System.Web.Mail.MailFormat.Html;
System.Web.Mail.SmtpMail SmtpMail;
SmtpMail.SmtpServer = txtSMTPServer.Text;
SmtpMail.Send(myMessage);
MessageBox.Show("Email sent successfully", "Alert", MessageBoxButtons.OK);
}
catch{
MessageBox.Show("Email disn't sent successfully", "Alert", MessageBoxButtons.OK);
}
Button1.Enabled =
true;}

I can't send mail
Carsten M. Horlacher
Hi
Have a looksie here
http://www.codeproject.com/csharp/Email_Sending_in_C_.asp
dgrm44
I downloaded the code. When I send mail, it shows "Could not access 'CDO.Message' object".
Please read this: http://mail.google.com/support/bin/answer.py answer=13287&topic=1555
Gmail and Yahoo require UserName, Password and Email Address but that code doesn't have Email Address
Stormslayer
sabfix
Ferry Meidianto
I asume you have to provide a valid gmail mailadres. Google/Gmail tries to prevent his mailserver to be used by Spammers.
So that is the reason, you have to provide a username, password and a valid from_mailadres.
Good luck! HTH
Marcel
NB2006
GTG
Cool
please read my previous thread for password encryption
mark replied, pls
harrha19
Now it really works. Thank you very much.
But I receive this message when I check mail:
This is an automatically generated Delivery Status Notification
Delivery to the following recipient failed permanently:
ndtoan@gmail.com
Technical details of permanent failure:
PERM_FAILURE: DNS Error: Domain name not found
----- Original message -----
Received: by 10.65.191.13 with SMTP id t13mr1379787qbp;
Tue, 04 Apr 2006 19:14:42 -0700 (PDT)
Return-Path: <ndtoan@gmail.com>
Received: from toan ( [125.214.63.169])
by mx.gmail.com with ESMTP id f17sm2102985qba.2006.04.04.19.14.40;
Tue, 04 Apr 2006 19:14:41 -0700 (PDT)
thread-index: AcZYVrTvdZXKY/TJQEiG7BBuxieB8g==
Thread-Topic: Asking
From: "Toan Duc Nguyen" <ndtoan@gmail.com>
To: <ndtoan@gmail.com>
Subject: Asking
Date: Wed, 5 Apr 2006 09:14:45 +0700
Message-ID: <000001c65856$b510b2c0$0b64a8c0@toan>
By the way, I wanna convert password into *********, and convert int into string. How can I do that
Turru
I think this is the best way to do it
http://groups.google.co.za/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/b901f1f8e50e238a/ffa899bd08906ddf%23ffa899bd08906ddf
Peter Holmdahl
Hi
This is how I do it using VC#2005 Express
using
System.Net.Mail; //namespace MailMessage mail = new MailMessage();mail.To.Add(
"ddd@mass.com");mail.Subject =
"My Subject";mail.From =
new MailAddress("ddd@mass.com");mail.Body =
"My body"; SmtpClient smtp = new SmtpClient("SMTP Server");smtp.Send(mail);
abv10200
hi
sorry for the confusion, here http://www.codeproject.com/useritems/Sending_Mails_From_C_.asp
Hope this helps
notoryus
hi Toan
mmmhhh this article seem to explain your problem
http://blogs.wwwcoder.com/pradeepd/archive/2004/01/28/236.aspx