By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,919 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,919 IT Pros & Developers. It's quick & easy.

Error in email code

P: 56
Hello

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
  1. Smtpserver.Send(myMessage)
But that doesn't tell me much, or how to correct it.

This is my SMTP code (stripped):

Expand|Select|Wrap|Line Numbers
  1.  Protected Sub SendEmail_Click(sender As Object, e As System.EventArgs) Handles SendEmail.Click
  2.  
  3. Dim myMessage As New MailMessage
  4. Dim Smtpserver As New SmtpClient
  5.  
  6. Dim user_name As String = Request.Form("user_name")
  7. Dim user_email As String = Request.Form("user_email")
  8. Dim user_subject As String = Request.Form("user_subject")
  9. Dim user_message As String = Request.Form("user_message")
  10.  
  11. myMessage.From = New MailAddress(user_email) 'User email
  12. myMessage.To.Add(New MailAddress("info@mysite.com")) 'Webmaster
  13. myMessage.CC.Add(New MailAddress("info1@mysite.com")) 'Webmaster's assistant
  14.  
  15. myMessage.Subject = user_subject
  16. myMessage.Body = user_message
  17.  
  18. Smtpserver.Host = ("IP_Add")
  19. Smtpserver.Port = 25
  20.  
  21. Dim basicAuthenticationInfo As New System.Net.NetworkCredential("info@mysite.com", "pwd")
  22. Smtpserver.Send(myMessage)
Where could the error be, please? This is the URL:

http://www.dimadayoub.net/frina/Contact.aspx

Thank you.
Jan 17 '18 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 1,035
Did you read the error message?
Especially this part:
"The server response was: Greylisted, please try again in 180 seconds"

So, wait for 180 seconds, and ty again!

Greylisting is a way to avoid SPAM. A 'normal' spammer only tries 1 time to send mail, and does not care about failed delivery's. A 'normal' mailserver will retry sending the message several times. It will only stop sending after a configured time (a couple of days)
Feb 3 '18 #2

P: 56
Thanks, Luuk

I didn't know that.

Sorry for the delay in replying - I was disconnected.

Regards
Mar 20 '18 #3

P: 2
Sometimes your SMTP server may return a particular error message. The problem is that it will generally be very cryptic, like "550 Requested action not taken: mailbox unavailable" or "421 Try again later". What does these numbers mean?

First of all: not any reply code is an error. Sometimes it's just a response containing a detail about the server or an answer to a command. Secondly: any code consist of three digits, and each conveys a particular information. The first one defines whether the server has accepted the command, fulfilled an action, run into a temporary issue, encountered an error etc; the second and the third one refine the description further, stating if there's been a syntactic problem, or a connection trouble etc.

Unfortunately, different servers sometimes use these codes in a different way, making the whole thing even more complicated... Anyhow, the most critical series of error messages is the 5xx one, and especially the ones from 550 to 559. In particular, you will probably get a lot of 550 SMTP error codes that is, a problem that concerns the recipient's email address.

Finally, remember that it's much easier to deal with these error codes if you choose to rely on a professional SMTP server that will help you solve any issue.

Best Advice:
Similar to email marketing, sending largely depends on target audience. The service SMS helps for a marketer to send his message to multiple consumers with a personal approach and with 100% rate of positive reading of the text.
Mar 21 '18 #4

Expert 100+
P: 1,035
The truth is any 5xx error will, and should,make it clear that an SMTP message is NOT accepted by the server!

A 4xx error can, (and maybe even should if needed!), be re-tried!
Mar 22 '18 #5

Post your reply

Sign in to post your reply or Sign up for a free account.