|
-
Feb 10th, 2007, 06:30 AM
#1
Thread Starter
Addicted Member
Sending mail using SMTP server
hiiiiiiiiiii,
i was written the code like that,
string from = "[email protected]";
string to = "[email protected]";
string subject = "testing";
string body = "smtp tested";
MailMessage message = new MailMessage(from, to, subject , body);
SmtpClient emailClient = new SmtpClient("smtp.gmail.com", 587);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("ssssssss","yyyyyyy");
emailClient.UseDefaultCredentials = false;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(message);
textBox1.Text = "Message Sent";
i got the error message "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first 36sm6260958nza".
if anybody know how to rectify the problem. plz reply.
-
Feb 12th, 2007, 08:51 AM
#2
Hyperactive Member
Re: Sending mail using SMTP server
I tried this sometime ago and was getting similar problems. Seems that GMail have authentication on their SMTP server. Try this, last time i tested it, it worked, and i was using the 1.0 framework.
Code:
MailMessage EMail = new MailMessage();
EMail.To = "[email protected]";
EMail.From = "[email protected]";
EMail.Subject = "[email protected]";
EMail.Body = "Body";
SmtpMail.SmtpServer = "127.0.0.1"; // specify your smtp server here.
try
{
SmtpMail.Send(EMail);
}
catch(Exception) {}
Hope this helps... Jennifer
-
Feb 13th, 2007, 08:00 AM
#3
Fanatic Member
Re: Sending mail using SMTP server
That a look at the following sending mail via Gmail Article
Hope this helps!!!
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|