473,549 Members | 2,982 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SmtpFailedRecip ientException/s - how it works?

Hi! I'm studing SmtpFailedRecip ientException to trap errors when I'm sending
e-mail.
I modified a sample code founded on MSDN so:

public static void errorMail()
{
MailAddress from = new MailAddress("fa *********@xxx.i t");
MailAddress to = new MailAddress("we *******@xxx.it" );
MailMessage message = new MailMessage(fro m, to);
message.Subject = "Using the SmtpClient class.";
message.Body = @"Using this feature, you can send an e-mail message from
an application very easily.";
SmtpClient client = new SmtpClient("smt p.xxx.it");
// Include credentials if the server requires them.
client.Credenti als =
(ICredentialsBy Host)Credential Cache.DefaultNe tworkCredential s;
Console.WriteLi ne("Sending an e-mail message to {0} using the SMTP host
{1}.", to.Address, client.Host);

try
{
client.Send(mes sage);
}
catch (SmtpFailedReci pientException ex) {
Console.WriteLi ne("Failed to deliver message to {0}",
ex.FailedRecipi ent);
//send e-mail back
MailMessage messageError = new MailMessage(fro m, from);
messageError.Su bject = "Error - " + message.Subject ;
messageError.Bo dy = ex.Message;
client.Send(mes sageError);
}
}
I don't understand why it doesn't work well!
If I send an e-mail to a unavailable mailbox inside my smtp client there is
the SmtpFailedRecip ientException and it works fine but if I try to an
external unavailable mailbox I don't receive any exception. Where I make the
mistake? how can I solve it?

thanks
Fabio Visin
Apr 11 '07 #1
4 10850
Hi Fabio,

From your description, you're using the .NET 2.0 SmtpClient class to send
email and found that you'll get exception if you send mail to an invalid
address in local network, but didn't get any error when send to an external
invalid address ,correct?

As for this problem, I think the error you got when sending to local
invalid recipient is due to the SMTP server's validation. Are you sending
through a network SMTP server(such as Exchange server)? The SMTP server in
local environent may valid the recipient address immediately(if it is a
local address) and raise error if it is invalid. For external email
address, since the SMTP request will be foward to external intermediate
node, the local SMTP server may not validate it at the exact time,
therefore, your SMTP client does not receive such error information.
Actually, for those mail client such as outlook, when sending it the mail
,it will not validate external mail address immediately. It is later after
the external node send back error message will it popup message sending
fail error. The SmtpClient component will close the communcation with
server right after the message has been sent out, but not trace the
sequentital message delivery status.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 12 '07 #2
Hi Steven,
thanks for the reply, your analysis is completely correct.
Reading your explanation I don't understand the real use of this exception
if I can't get the correct information. Is there the possibility, with a
different approach too, to trace the sequential message delivery status?
I have to check the validity of many e-mail address stored in my DB but I
can't do it manually, there are too much! ;)

Thanks
Fabio
Apr 12 '07 #3
Nobody can help me?
Thanks
Fabio
"Fabio Visin" <fa*********@co mmunity.nospamh a scritto nel messaggio
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi Steven,
thanks for the reply, your analysis is completely correct.
Reading your explanation I don't understand the real use of this exception
if I can't get the correct information. Is there the possibility, with a
different approach too, to trace the sequential message delivery status?
I have to check the validity of many e-mail address stored in my DB but I
can't do it manually, there are too much! ;)

Thanks
Fabio

Apr 17 '07 #4
Hi Fabio,

After some further research, I found that this should be done through the
smtp server's setting. For example, if your local smtp server is a network
exchange server, the exchange server contains storage for each local
users(on the server) and there you can query the failture messages for each
given user. For other smtp server, it may have different setting or
interface.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 18 '07 #5

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

Similar topics

1
2140
by: Gerd Güldenast | last post by:
Hi, I am having a problem with a replication over a Modem-Connection, which works fine over LAN. Has anyone experienced this problem before? Settings are: 2 SQL Servers 2000, SP3 on Windows 2000 Publischer Database ist about 3GB, Subscriber DB about 1,5GB Publisher and Subscriber are connected via 56Kbit Dial-Up --> The Replication...
10
3571
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
1
3104
by: Moi | last post by:
I have tried repeatedly to import a MS Works database (simple address database) into Access, but I am having little luck. I have saved the Works file as DbaseIII DbaseIV and neither is seen by the Access importer. Does anyone have any advice or a link that might help me through this. Much thanks in advance.
2
2160
by: Enrique Bustamante | last post by:
Casting arrays that works on watch and command window but not in code. My application is casting arrays in a way it should work. To test if I was doing something invalid, I wrote a test code that has similar structure of the classes in my application. The test worked fine, the casting I want to do must work. I compared the structure of the...
4
2292
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load. My CSS file works fine in IE 6.0 when i specify the absolute path. eg- href ="D:\Mywebsite\css\mycssfile.css" but this full path does not work in...
0
1135
by: patmg | last post by:
Hello, We use a SQL Server database to manage accounts in AD via a COM object using ADSI written in VB6. I have to move this database to a new server. The only real difference between the two servers is that one is running Windows 2000 Server and the other is running Windows 2003 Server. Both are running SQL Server 2000. Everything works...
3
1591
by: Miro | last post by:
First off...thanks in advance for getting me this far. Sorry for all these class posts but im having a heck of a time here trying to get something to work, and have finally got it to work ( yahooooo ) but i dont know why now I cant get it to work the other way. Vb 2003 Below are 2 examples. One Does not work and the other does.
5
2708
by: MorpheusX | last post by:
Hi I have been having problems with smptclient in asp.net 2.0(C#). I found everytime I put a fake email address or any dodgy ones, it nevers calls SmtpFailedRecipientException in the catch statement. Any ideas why please? This is my coding: try { MailAddress fromAddress = new MailAddress(From, Name); ...
0
2711
by: Velvet | last post by:
Our staging server has several web sites that send emails. Most of the sites can send email but one of them is gettting the following message when HTML formatted email is sent. We created a test page and verifyied that the exact same code works on another website but not this one. The interesting thing is that the email is in fact sent and...
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.