When I debug my SMTP code, which is not sending a form, I get the following:
Troubleshooting Exceptions: System.Net.Mail.SmtpException
- The exception that is thrown when the SmtpClient is not able to send a Send
System.Net.Mail.SmtpException was caught
HResult=-2146233088
Message=Error in processing. The server response was: Greylisted, please try again in 180 seconds
Source=System
StackTrace:
at System.Net.Mail.RecipientCommand.CheckResponse(Smt pStatusCode statusCode, String response)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Contact.SendEmail_Click(Object sender, EventArgs e) in C:\Users\Steve\Documents\Visual Studio 2013\VHS-DVD\Contact.aspx.vb:line 140
InnerException:
Line 140 is this:
Expand|Select|Wrap|Line Numbers
- Smtpserver.Send(myMessage)
This is my SMTP code (stripped):
Expand|Select|Wrap|Line Numbers
- Protected Sub SendEmail_Click(sender As Object, e As System.EventArgs) Handles SendEmail.Click
- Dim myMessage As New MailMessage
- Dim Smtpserver As New SmtpClient
- Dim user_name As String = Request.Form("user_name")
- Dim user_email As String = Request.Form("user_email")
- Dim user_subject As String = Request.Form("user_subject")
- Dim user_message As String = Request.Form("user_message")
- myMessage.From = New MailAddress(user_email) 'User email
- myMessage.To.Add(New MailAddress("info@mysite.com")) 'Webmaster
- myMessage.CC.Add(New MailAddress("info1@mysite.com")) 'Webmaster's assistant
- myMessage.Subject = user_subject
- myMessage.Body = user_message
- Smtpserver.Host = ("IP_Add")
- Smtpserver.Port = 25
- Dim basicAuthenticationInfo As New System.Net.NetworkCredential("info@mysite.com", "pwd")
- Smtpserver.Send(myMessage)
http://www.dimadayoub.net/frina/Contact.aspx
Thank you.