//web.config
system.net
mailsettings
smtp from="your_gmail_email@gmail.com"
network host="smtp.gmail.com" password="your_gmail_password" port="587" username="your_gmail_email@gmail.com"
network
smtp
mailsettings
Note: Please keep all the above code in tags format
//pageload
using System.Net.Mail;
using System.Net;
SmtpClient mailClient = new SmtpClient("smtp.gmail.com", "587");
mailClient.EnableSsl = true;
NetworkCredential cred = new NetworkCredential("your_gmail_username","your_gmail_password");
mailClient.Credentials = cred;
mailClient.Send("from_me@gmail.com", "to_you@gmail.com","subject goes here", "email body goes here");
Note: Mail Codes for Other Email-Accounts
yahoo ---> smtp.mail.yahoo.com (port 25)
//gmail ---> smtp.gmail.com (SSL enabled, port 465)
//AOL ---> smtp.aol.com
//Netscape ---> smtp.isp.netscape.com (port 25)
system.net
mailsettings
smtp from="your_gmail_email@gmail.com"
network host="smtp.gmail.com" password="your_gmail_password" port="587" username="your_gmail_email@gmail.com"
network
smtp
mailsettings
Note: Please keep all the above code in tags format
//pageload
using System.Net.Mail;
using System.Net;
SmtpClient mailClient = new SmtpClient("smtp.gmail.com", "587");
mailClient.EnableSsl = true;
NetworkCredential cred = new NetworkCredential("your_gmail_username","your_gmail_password");
mailClient.Credentials = cred;
mailClient.Send("from_me@gmail.com", "to_you@gmail.com","subject goes here", "email body goes here");
Note: Mail Codes for Other Email-Accounts
yahoo ---> smtp.mail.yahoo.com (port 25)
//gmail ---> smtp.gmail.com (SSL enabled, port 465)
//AOL ---> smtp.aol.com
//Netscape ---> smtp.isp.netscape.com (port 25)
No comments:
Post a Comment