473,396 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error in email code

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
4 3985
Luuk
1,047 Expert 1GB
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
Thanks, Luuk

I didn't know that.

Sorry for the delay in replying - I was disconnected.

Regards
Mar 20 '18 #3
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
Luuk
1,047 Expert 1GB
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

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

Similar topics

0
by: sql-db2-dba | last post by:
CLI connection failed. SQL0902C. A system error (reason code="6029321") occurred. Subsequent SQL statements cannot be processed. SQLSTATE=58005. Has anyone encountered the above error? We are...
1
by: Tom | last post by:
Suppose you have code structure like this: Option Explicit Dim MyVariable As Single Private Sub CallingProcedure() Call CalledProcedure() ....Do This ... End Sub Private Sub...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
1
by: Robert V. Hanson | last post by:
Please give me some ideas on how to setup the ability to test System.Web.Mail code to send emails using just my development computer, Win2000Pro OS and IIS5.0? Thanks, Bob Hanson
3
by: JPARKER | last post by:
Our DB2 8.2 FixPak9 database running on Win2K crashed with after reporting this message SQL0902C A system error (reason code = 9") ocurred I have searched the DB2 documentation as well as the...
3
by: Mark | last post by:
I'm just starting out in an introductory ASP.Net course, and am trying to run a simple program but keeping getting an error. "http://localhost/day1/listing0104.aspx" is placed in the address line...
1
by: scottrm | last post by:
I want to get the file name, line number etc. in error handling code in an asp.net application. I know how to trap errors in the Global.asax and I read that you can use the stack frame from the...
1
by: Liam.M | last post by:
I currently HAVE a form...a "Summary List" it could be called...which is a contineous form...AND on this form are "Four fields" from EVERY record (each on their own line) so to seak...like a...
3
by: jonamukundu | last post by:
Hi everyone out there I have a rather funny problem. Error handling code routines do not seem to work on my laptop. I still get the default error messages when i test. One my desktop the code...
2
by: globomike | last post by:
Hi, can anybody tell me what the reason code 18 means in combination with a SQL0902 error? It would be helpful to know details about the reason code but I could not find any details about that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.