Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 11th, 2007, 03:21 PM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default SMTP Email Error Handling

In need to verify whether email addresses passed to an SMTP component in a eweb page are valid. This Try/Catch does NOT return an error if the email address is invalid:

Try
  Dim smtp As New SmtpClient(ConfigurationManager.AppSettings("SMTPS erverName"))

  smtp.Send(mail)
Catch
  m_strErrorMessage = String.Concat("Unable to send email: ", Err.Description)
End Try

...and because it is being sent by the server, the user sending the email never knows it was not delivered. Is there some way to either verify the email addresses entered or catch undeliverable email?
  #2 (permalink)  
Old July 12th, 2007, 08:32 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The mail server won't know that its undeliverable until it tries to send it. "Sending" a message from .NET doesn't really actually send the message. All it does it hand it off to the SMTP server for sending.

An SMTP server can only verify that a email address is bad if that SMTP server is responsible for handling addresses to the email address host. Example:

You have a mail server mail.somedomain.com which handles messages to any email @somedomain.com. If you connect to that mail server and try "emailaddressthatdoesntexist@somedomain.com" that server can deny that mail because it knows that the mail account "emailaddressthatdoesntexist" does indeed not exist. However, if you send mail to "emailaddressthatdoesntexist@someotherdomain.c om", your mail server won't know whether it's good or bad until it tries to connect to "someotherdomain.com"'s mail server to relay the message. By then, your Send call has completed. In fact, it could be days before the message goes thru as the mail server tries to relay the message depending on lots of factors.

If you are sending the mail FROM a monitored account, then the sending mail server should return a bounce message if it doesn't succeed.

-Peter
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem sending email with SMTP in VB.Net Compiler Forum and Wrox.com Feedback 3 November 30th, 2007 07:25 PM
sending email with SMTP authentication (port 26) crmpicco PHP How-To 3 November 4th, 2007 01:18 PM
Sending EMail thru SMTP server in C# - Most of the peri C# 1 December 20th, 2004 09:33 PM
mail() is not sending email on localhost SMTP anshul PHP How-To 5 August 4th, 2004 06:45 AM
Smtp blocked, how can I send email use asp.net calvinpost ASP.NET 1.x and 2.0 Application Design 7 April 1st, 2004 09:41 AM



All times are GMT -4. The time now is 11:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.