Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I want to make a web application to sending mail [closed]
- using System.Net.Mail;
- using System.Net;
- SmtpClient mailClient = new SmtpClient("smtp.gmail.com", "587");
- mailClient.EnableSsl = true;
- mailClient.Credentials = new NetworkCredential("gmail_username", "gmail_password");
- mailClient.Send("from@gmail.com",
- "to@gmail.com",
- "subject goes here",
- "email body goes here");
- MailMessage message = new MailMessage();
- message.From = new MailAddress("sender@foo.bar.com");
- message.To.Add(new MailAddress("recipient1@foo.bar.com"));
- message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
- message.Subject = "This is my subject";
- message.Body = "This is the content";
- SmtpClient client = new SmtpClient();
- client.Send(message);
- <system.net>
- <mailSettings>
- <smtp from="test@foo.com">
- <network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" />
- </smtp>
- </mailSettings>
- </system.net>
Add Comment
Please, Sign In to add comment