asp.net - C# - Failure sending mail -


This code works fine on my local machine unit when I apply it. It returns the failure to send mail error. Please help ...

  mailadders addrsTo = new mail address (toEmail); MailAdderEdersFraam = New MailAdd ("XXX@XXX.com", "XXX Title"); Mail message mess = new mailmessage (addrsFrom, addrsTo); Mailmsg.Subject = mailSbjct; Mailmsg.Body = "XXX body"; SmtpClient smtp = New SmtpClient ("mail.XXX.com"); Smtp.EnableSsl = false; Smtp.Port = 26; Smtp.Credentials = New network credentials ("XXX@XXX.com", "XXXXXXX"); Try {smtp.Send (mailmsg); } Catch (exception exc) {new XXXException (1234, "---" + exc.Message); }    

You can try this, if you are using:

  mail message mail = new mail form (); Mail.Subject = "Your Theme"; similarity. From = new mail address ("sender mail address"); Mail.To.Add ("ReceiverMailAddress"); Mail.Body = "Hello! Your mail content goes here ..."; Mail.IsBodyHtml = True; SmtpClient smtp = New SmtpClient ("smtp.gmail.com", 587); Smtp.EnableSsl = true; Network Credential Network = New Network Credentials ("Sender Mail Address", "Sender Password"); Smtp.Credentials = netCre; Try {Smtp.Send}; } Hold (Exception Pre) {}    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -