473,490 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Email Problem

I have an unusual error occurring when sending email from an ASP.NET
page. Basically, the first attempt at sending an email fails, whilst
subsequent attempts succeed without any issues. The code looks like
this:

MailMessage msg = new MailMessage();
msg.From = "te********@myaddress.com";
msg.To = "bo***@myaddress.com";
msg.Body = "Testing Mail";
msg.BodyFormat = MailFormat.Text;
msg.Subject = "Testing Mail";
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["MailServer"];
SmtpMail.Send(msg);

The error messages i get by iterating through the inner exceptions of
the thrown exception are:

1st ex - Could not access 'CDO.Message' object
2nd ex - Exception has been thrown by the target of an invocation
3rd ex - The transport failed to connect to the server

I also tried using the Indy.Sockets.IndySMTP from
http://www.atozed.com/indy/ to see if this fixed the problem, but
nope, same issues.

The web server is a win2003 server. The SmtpServer variable is stored
in web.config, and is the IP address of our unix SendMail server. Its
kind of weird that the first attempt fails, then subsequent attempts
(spanning multiple sessions) succeed. Has anyone seen this before?
what did you do to fix it?
Jul 21 '05 #1
3 1189
just a hunch...
you could try turning on SMTP services on the Windows 2003 box and
configuring it to forward all messages to the Unix box, then have your app
use the local server. The Windows SMTP server will be a lot more forgiving
if you are having connection issues, and will get the message delivered on a
retry, without affecting your web app.

Something I read somewhere...

Hope it helps,
--- Nick

"bondo" <mb***@astrum.com.au> wrote in message
news:8c**************************@posting.google.c om...
I have an unusual error occurring when sending email from an ASP.NET
page. Basically, the first attempt at sending an email fails, whilst
subsequent attempts succeed without any issues. The code looks like
this:

MailMessage msg = new MailMessage();
msg.From = "te********@myaddress.com";
msg.To = "bo***@myaddress.com";
msg.Body = "Testing Mail";
msg.BodyFormat = MailFormat.Text;
msg.Subject = "Testing Mail";
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["MailServer"];
SmtpMail.Send(msg);

The error messages i get by iterating through the inner exceptions of
the thrown exception are:

1st ex - Could not access 'CDO.Message' object
2nd ex - Exception has been thrown by the target of an invocation
3rd ex - The transport failed to connect to the server

I also tried using the Indy.Sockets.IndySMTP from
http://www.atozed.com/indy/ to see if this fixed the problem, but
nope, same issues.

The web server is a win2003 server. The SmtpServer variable is stored
in web.config, and is the IP address of our unix SendMail server. Its
kind of weird that the first attempt fails, then subsequent attempts
(spanning multiple sessions) succeed. Has anyone seen this before?
what did you do to fix it?

Jul 21 '05 #2

Hi Nick,

I'll try this on Monday and fingers crossed it will sort it out...

Thanks for the reply!

Mark

Nick Malik wrote:
just a hunch...
you could try turning on SMTP services on the Windows 2003 box and
configuring it to forward all messages to the Unix box, then have your app
use the local server. The Windows SMTP server will be a lot more forgiving
if you are having connection issues, and will get the message delivered on a
retry, without affecting your web app.

Something I read somewhere...

Hope it helps,
--- Nick

Jul 21 '05 #3

Yep - that worked a treat, I set the SMTP server on the webserver to
relay to the sendmail server and problem has gone - works every time :)
Mark Bond wrote:

Hi Nick,

I'll try this on Monday and fingers crossed it will sort it out...

Thanks for the reply!

Mark

Nick Malik wrote:
just a hunch...
you could try turning on SMTP services on the Windows 2003 box and
configuring it to forward all messages to the Unix box, then have your
app
use the local server. The Windows SMTP server will be a lot more
forgiving
if you are having connection issues, and will get the message
delivered on a
retry, without affecting your web app.

Something I read somewhere...

Hope it helps,
--- Nick

Jul 21 '05 #4

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

Similar topics

3
1917
by: jpastora | last post by:
I'm having a strange problem with our email links on the domain : http://www.pc350.com/ . The problem is that when you click on an email link, the email app is not launched until the browser...
6
3439
by: mike | last post by:
I have created a side application in VB.NET which reads rows from a DB and builds an email message. when i have a long string the the mailmessage.body or the mailmessage, it puts in an...
88
12311
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
0
2128
by: VP | last post by:
g'day, i am posting a problem i have encountered with creating an email using outlook through some basic c# code. the problem arises when using different email editors in outlook. At the moment...
14
9100
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
26
2643
by: libsfan01 | last post by:
Hi all! Can anyone show me how to check and email field on a form for the existence of these two characters. Kind regards Marc
0
4207
by: RickVidallon | last post by:
Missing or Truncated Body Text in Email Application - 2 Strange Examples... There is no earthly reason why this is happening! EXAMPLES HERE: http://65.36.227.70/actmailer/ We have a...
3
3815
by: Steven Allport | last post by:
I am working on processing eml email message using the email module (python 2.5), on files exported from an Outlook PST file, to extract the composite parts of the email. In most instances this...
3
8909
by: IGD | last post by:
I don't know if this is the right place to post this or not. If not, could someone direct me elsewhere where I would find more information on how to solve my problem? Thanks! My problem is this:...
28
4391
tdw
by: tdw | last post by:
Hi all, I am trying to add a feature to our database that automates sending emails. When entering a new order, I want the option to send an email to the company the order came from, attaching a...
0
7112
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
6974
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
7146
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
7356
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
5448
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,...
0
4573
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...
0
3084
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...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
277
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...

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.