Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Send email from Gmail account using Goddady
- public static bool _SendMail(string tMailTo, string tSubject, string tBody, string tAttach)
- {
- MailMessage mail = new MailMessage();
- mail.From = new MailAddress(tMailFrom);
- mail.To.Add(tMailTo);
- mail.Subject = tSubject;
- if (!tAttach.Equals(""))
- {
- mail.Attachments.Add(new Attachment(tAttach));
- }
- mail.Body = tBody;
- mail.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "relay-hosting.secureserver.net";
- smtp.Send(mail);
- return true;
- }
- smtp.Credentials = new NetworkCredential(smtpUser, smtpPass);
- smtp.EnableSsl = true;
- <system.net>
- <mailSettings>
- <smtp deliveryMethod="Network" from="username@gmail.com">
- <network host="smtp.gmail.com" userName="username@gmail.com" password="password" enableSsl="true" port="587" />
- </smtp>
- </mailSettings>
Add Comment
Please, Sign In to add comment