Hi, I have written a code for sending email as follows: protected void Button1_Click(object sender, EventArgs e) { MailMessage mailMSG = new MailMessage("abc@domain.com", "def@domain.com"); mailMSG.Subject = "TEST"; mailMSG.Body = "this is for test"; SmtpClient smtp = new SmtpClient(); System.Net.NetworkCredential basicAuthenicationInfo = new System.Net.NetworkCredential("username", "password"); smtp.Host = "mailhost.domain.com"; smtp.UseDefaultCredentials = false; smtp.Credentials = basicAuthenicationInfo; smtp.Send(mailMSG); } it works properly on local server. However, after deployment on main server I get this error :"Failure in sending email:System.Web.HttpException: At least one of the From or Sender fields is required, and neither was found ...................." Could you please tell me what is the problem.
Self explanatory error. Add From/To e.g. MailMessage mailMSG = new MailMessage(); mailMSG.To.Add(new MailAddress("abc@domain.com")); mailMSG.From = new MailAddress("def@domain.com"); etc. Welcome to the forum www.vbisbetter.com
chek it it will realy help full for sedning email in asp.net Dim frm As String = "from@my.com" Dim mTo As String = "to@gmail.com" Dim subject As String = "Email" Dim msgtext As String = "This is my personal websites good na" Dim msg As New Net.Mail.MailMessage(frm, mTo, subject, msgtext) 'msg.Attachments.Add(New System.Net.Mail.Attachment(FileUpload1.PostedFile.FileName)) Dim strName As String = FileUpload1.PostedFile.FileName