Hi all ,
For 3 days i have been searching on google and trying every provided solution but nothing worked for me.I am sending an email through gmail in asp.net.The email is being sent and received by the receiver.But after it is sent the asp.net is generating this error :
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. p18sm4404756wbh.38
And here is my code that is written on sending email event for create user wizard :
Public Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail
Try
Dim user As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName.ToString())
Dim userId As Guid = DirectCast(user.ProviderUserKey, Guid)
Dim smtp As New SmtpClient()
e.Message.IsBodyHtml = True
e.Message.Subject = "Allo Magazine : Registration Confirmation Email"
e.Message.Body = e.Message.Body.Replace("<%AC%>", userId.ToString())
smtp.Host = "smtp.gmail.com"
smtp.DeliveryMethod = SmtpDeliveryMethod.Network
smtp.UseDefaultCredentials = False
smtp.Port = 587
smtp.EnableSsl = True
smtp.Credentials = New NetworkCredential("[DELETED]@gmail.com", "password")
smtp.Send(e.Message)
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Also i have this mail definition in the create user wizard :
<MailDefinition Priority="High" BodyFileName="~/ConfirmationEmailHTML/ConfirmationEmail.htm"
Subject="Allo Magazine : Registration Confirmation Email" From="[DELETED]@gmail.com">
</MailDefinition>
And this is what in the web.config.
<system.net>
<mailSettings >
<smtp deliveryMethod="Network" from="[DELETED]@gmail.com" >
<network defaultCredentials="false" host="smtp.gmail.com" port="587" userName="[DELETED]@gmail.com" password="password" />
</smtp>
</mailSettings>
</system.net>
Please help me guys,i am about to loose my job.
[edit]Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know - OriginalGriff[/edit]