473,387 Members | 1,790 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,387 software developers and data experts.

Sending email with invalid address

Hi folks,

I am using the Send method in the System.Web.Mail.SmtpMail class.

If I pass an address that does not exist or is in anyway invalid, I throw and
exception as shown below. I need to determine how I can check to see
if the email address is invalid before I call the Send method which does not
return a value. - thanks, - Glenn

Server Error in '/' Application.
--------------------------------------------------------------------------------

The server rejected one or more recipient addresses. The server response
was: 550 5.1.1 <gl****@yazo.comUser unknown; rejecting
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server
rejected one or more recipient addresses. The server response was: 550 5.1.1
<gl****@yazo.comUser unknown; rejecting

Source Error:
Line 185:
Line 186: System.Web.Mail.SmtpMail.SmtpServer = "mail.yazo.com"
Line 187: System.Web.Mail.SmtpMail.Send(mailMessage)
Line 188: End Sub
Line 189:
Aug 24 '06 #1
2 6354
usually the mail will be relayed to another mail server and then it will be
rejected back later if it is invalid, you won't get any exception because
your code won't wait for the mail servers to communicate with each other.
however in your case the mailbox is on the server you specify so it rejects
the message straight away, and you get the exception.
i think your only option is to add a try and catch block around your code
and then act accordingly if the message fails.
it's a good idea to have this anyway because the connection to the mail
server could be down. there are a host of reasons why the message could fail
and without a try/catch your code will crash in these situations. the mail
component used in .net 1.1 wasn't very good, the 2.0 System.Net.Mail
component is much improved, something to look forward to!

tim

--------------------------
blog: http://tim.mackey.ie

"glenn" <gl***@discussions.microsoft.comwrote in message
news:39**********************************@microsof t.com...
Hi folks,

I am using the Send method in the System.Web.Mail.SmtpMail class.

If I pass an address that does not exist or is in anyway invalid, I throw
and
exception as shown below. I need to determine how I can check to see
if the email address is invalid before I call the Send method which does
not
return a value. - thanks, - Glenn

Server Error in '/' Application.
--------------------------------------------------------------------------------

The server rejected one or more recipient addresses. The server response
was: 550 5.1.1 <gl****@yazo.comUser unknown; rejecting
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server
rejected one or more recipient addresses. The server response was: 550
5.1.1
<gl****@yazo.comUser unknown; rejecting

Source Error:
Line 185:
Line 186: System.Web.Mail.SmtpMail.SmtpServer = "mail.yazo.com"
Line 187: System.Web.Mail.SmtpMail.Send(mailMessage)
Line 188: End Sub
Line 189:


Aug 24 '06 #2
Tim,

Thanks for your help on this issue. Regarding 2.0 vs 1.1, I have been a
little hesitant to migrate to 2.0 based on the problems I have heard
when attempting to do so. I plan to move on this soon and I suppose
it is inevitable and I have a good description of the process and the
gotcha's to look out for from online.

So I'll put that try catch block in...

Thanks again,

- Glenn

"Tim_Mac" wrote:
usually the mail will be relayed to another mail server and then it will be
rejected back later if it is invalid, you won't get any exception because
your code won't wait for the mail servers to communicate with each other.
however in your case the mailbox is on the server you specify so it rejects
the message straight away, and you get the exception.
i think your only option is to add a try and catch block around your code
and then act accordingly if the message fails.
it's a good idea to have this anyway because the connection to the mail
server could be down. there are a host of reasons why the message could fail
and without a try/catch your code will crash in these situations. the mail
component used in .net 1.1 wasn't very good, the 2.0 System.Net.Mail
component is much improved, something to look forward to!

tim

--------------------------
blog: http://tim.mackey.ie

"glenn" <gl***@discussions.microsoft.comwrote in message
news:39**********************************@microsof t.com...
Hi folks,

I am using the Send method in the System.Web.Mail.SmtpMail class.

If I pass an address that does not exist or is in anyway invalid, I throw
and
exception as shown below. I need to determine how I can check to see
if the email address is invalid before I call the Send method which does
not
return a value. - thanks, - Glenn

Server Error in '/' Application.
--------------------------------------------------------------------------------

The server rejected one or more recipient addresses. The server response
was: 550 5.1.1 <gl****@yazo.comUser unknown; rejecting
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server
rejected one or more recipient addresses. The server response was: 550
5.1.1
<gl****@yazo.comUser unknown; rejecting

Source Error:
Line 185:
Line 186: System.Web.Mail.SmtpMail.SmtpServer = "mail.yazo.com"
Line 187: System.Web.Mail.SmtpMail.Send(mailMessage)
Line 188: End Sub
Line 189:


Aug 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
4
by: Zeeway | last post by:
hi,every one! I have a question about sending emails.My codes works well over some smtp servers,but doesn't over the others. My codes is listed belowed: try { MailMessage mailObj = new...
1
by: handokowidjaja | last post by:
Hi All, Several weeks ago i started a topic with the same subject, however the solutions provided was for using MS Outlook (fullblown version). I finally found something that works directly with...
2
by: RAB | last post by:
I have a .aspx page with the following code: <% @Import Namespace="System.Web.Mail" %> <%@ page language="vb" debug="true" runat="server" %> <script runat="server"> Sub Click(sender as...
13
by: Ed Bitzer | last post by:
I have just written a utility (with help from this forum) to automatically send a sign-up sheet to a dozen tennis friends using Smtp.Send() from the System.Web.Mail namespace. I question that this...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
6
by: lakmarket | last post by:
Hi, I am trying to send some querysting using cURL. This is the working API ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.