Severity Code Description Project File Line Suppression State Error CS0104 'MailMessage' is an ambiguous reference between 'System.Net.Mail.MailMessage' and 'System.Web.Mail.MailMessage' Active
public void email_send(System.Net.Mail.MailAddress from, System.Net.Mail.MailAddress to) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("your mail@gmail.com"); mail.To.Add("to_mail@gmail.com"); mail.Subject = "Test Mail - 1"; mail.Body = "mail with attachment"; System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment("c:/textfile.txt"); mail.Attachments.Add(attachment); SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("your mail@gmail.com", "your password"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); }
using System.Net.Mail;
System.Net.Mail
using System.Web.Mail;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)