Asp.net Mail Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site smtp exception failure sending mail About Us Learn more about Stack Overflow the company Business Learn more about c# send email example hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss c# send email gmail Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up why getting SMTP error system.net.mail.smtpexception failure sending mail in asp.net up vote 0 down vote favorite I have login page.login is working fine but when trying to create new user, I'm getting Error:The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. here is code which I am using to send mail public void SendConfirmationAfterRegister(String EmailID, String UserName) { MailMessage mailMsg = new
Failure Sending Mail C#
MailMessage(); String BodyMsg = UserName + ", \r\n\nWe have recieved your request to become a user of our site. Upon review, we will send you verification for site access.\r\n\n" + "Thank you, \r\n\nMuda Admin"; try { var client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential(ConfigurationManager.AppSettings["AdminEmail"].ToString(), ConfigurationManager.AppSettings["Pwd"].ToString()), EnableSsl = true }; mailMsg.IsBodyHtml = true; client.Send(ConfigurationManager.AppSettings["AdminEmail"].ToString(), EmailID, "Received Your Request", BodyMsg); client.Send(ConfigurationManager.AppSettings["AdminEmail"].ToString(), "mymailId", "User Needs Access", EmailID + " looking for access the xyz Network Site."); } catch (Exception ex) { throw new Exception(ex.Message); } } can any one what is wrong c# asp.net smtp smtpclient share|improve this question edited Feb 18 at 6:39 Sankar Raj 1,9881621 asked Feb 18 at 5:11 veena hosur 26 try with changing the port number to 25 –Sankar Raj Feb 18 at 5:36 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted Try this: public void SendConfirmationAfterRegister(String EmailID, String UserName) { MailMessage mailMsg = new MailMessage(); String BodyMsg = UserName + ", \r\n\nWe have received your request to become a user of our site. Upon review, we will send you verification for site access.\r\n\n" + "Thank you, \r\n\nMuda Admin
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV
Smtp Client C#
Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation smtpclient failure sending mail APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has failure sending mail. at system.net.mail.smtpclient.send(mailmessage message) been removed. You’ll be auto redirected in 1 second. .NET Framework Class Library System.Net Namespaces System.Net.Mail System.Net.Mail SmtpException Class SmtpException Class SmtpException Class AlternateView http://stackoverflow.com/questions/35473316/why-getting-smtp-error-in-asp-net Class AlternateViewCollection Class Attachment Class AttachmentBase Class AttachmentCollection Class DeliveryNotificationOptions Enumeration LinkedResource Class LinkedResourceCollection Class MailAddress Class MailAddressCollection Class MailMessage Class MailPriority Enumeration SendCompletedEventHandler Delegate SmtpAccess Enumeration SmtpClient Class SmtpDeliveryFormat Enumeration SmtpDeliveryMethod Enumeration SmtpException Class SmtpException Constructor SmtpException Methods SmtpException Properties SmtpException Events SmtpFailedRecipientException Class SmtpFailedRecipientsException Class SmtpPermission Class SmtpPermissionAttribute https://msdn.microsoft.com/en-us/library/system.net.mail.smtpexception(v=vs.110).aspx Class SmtpStatusCode Enumeration TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. SmtpException Class .NET Framework (current version) Other Versions Visual Studio 2010 .NET Framework 4 Visual Studio 2008 .NET Framework 3.5 .NET Framework 3.0 .NET Framework 2.0 Represents the exception that is thrown when the SmtpClient is not able to complete a Send or SendAsync operation.Namespace: System.Net.MailAssembly: System (in System.dll)Inheritance HierarchySystem.Object System.Exception System.Net.Mail.SmtpException System.Net.Mail.SmtpFailedRecipientExceptionSyntax C#C++F#VB Copy [SerializableAttribute] public class SmtpException : Exception, ISerializable ConstructorsNameDescriptionSmtpException()Initializes a new instance of the SmtpException class. SmtpException(SerializationInfo, StreamingContext) This API supports the product infrastructure and is not intended to be used directly from your code. Initializes a new instance of the SmtpException class from the specified instances of the SerializationInfo and StreamingContext classes. SmtpException(SmtpStatusCode)Initializes a new instance of the SmtpException class with
folks wondering about how to get started with it.Here is a simple snippet of how to send an email message from “sender@foo.bar.com” to multiple email recipients (note that the To http://weblogs.asp.net/scottgu/432854 a CC properties are collections and so can handle multiple address targets): MailMessage message = new MailMessage(); message.From = new MailAddress("sender@foo.bar.com"); message.To.Add(new MailAddress("recipient1@foo.bar.com")); message.To.Add(new MailAddress("recipient2@foo.bar.com")); message.To.Add(new MailAddress("recipient3@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.Mail reads SMTP configuration data out failure sending of the standard .NET configuration system (so for ASP.NET applications you’d configure this in your application’s web.config file). Here is an example of how to configure it: