473,406 Members | 2,336 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,406 software developers and data experts.

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 1187
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.