471,319 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Emails seemingly disappearing.. very strange problem

I have been tearing my hair out (or indeed, what's left of it) all day
with this one. I'm not sure if it's a .NET issue, a server issue or
anything else and would appreciate any guidance.

Basically, I have a web app that sends emails. Very basic code, nothing
fancy, and I have had it working on about 5 machines! It's hardly worth
pasting, but here's the send method from my email class anyway. As you
can see, very basic:

public void Send(string strTo, string strFrom)
{
if (_strBody != "")
{
// Do replacements here as well as on Compose, so that they can be
added at any time
ReplaceValues();

MailMessage newMailMessage = new MailMessage();
newMailMessage.BodyEncoding = System.Text.Encoding.UTF8;

if (_blnSendAsHTML)
{
newMailMessage.BodyFormat = MailFormat.Html;
}
else
{
newMailMessage.BodyFormat = MailFormat.Text;
}

newMailMessage.To = strTo;
newMailMessage.From = strFrom;

newMailMessage.Subject = strSubject;
newMailMessage.Body = _strBody;
SmtpMail.SmtpServer = strSmptServer;
SmtpMail.Send(newMailMessage);

}
else
{
Debug.Trace.WriteLine("Email body empty; email not sent.");
}

}

Okay, nothing special. Here is the strange problem: If we run it inside
our network here specifying our live server as the SmtpServer, all our
emails are sent fine with no problems.

IF however we deploy the app to our live server with the same
SmtpServer setting (our internet-facing IP) the method fires okay but
we don't get the emails but everything runs okay. No relay errors,
nothing in the trace, nothing appears in the IIS SMTP server log, no
emails go into the Drop or Badmail folders. Nothing at all happens.
I've run through it line-by-line in debug mode and all the properties
get populated with the right value and the SmtpServer send method fires
okay.

I assume this has to be a server configuration issue but I don't have a
clue why this would be working here (using the exact same live server
as SMTP server) but not on the live server. The fact that I'm getting
no errors and nothing from the logs is what's confusing the heck out of
me.

Does anybody have any ideas at all?

Thanks in advance,

Chris

Nov 28 '05 #1
6 1291
"Chris Ashley" <ch***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
IF however we deploy the app to our live server with the same
SmtpServer setting (our internet-facing IP) the method fires okay but
we don't get the emails but everything runs okay. No relay errors,
nothing in the trace, nothing appears in the IIS SMTP server log, no
emails go into the Drop or Badmail folders. Nothing at all happens.
I've run through it line-by-line in debug mode and all the properties
get populated with the right value and the SmtpServer send method fires
okay.


What happens if you telnet to port 25 on the server from the server (within
an RDP window) and try sending an email manually?
Nov 28 '05 #2

Danny Tuppeny wrote:

What happens if you telnet to port 25 on the server from the server (within
an RDP window) and try sending an email manually?


Hi Danny,

Just tried sending an email via telnet from the server itself and it
came through fine. Now I'm even more confused! Any idea?

Cheers,

Chris

Nov 29 '05 #3

Chris Ashley wrote:
Hi Danny,

Just tried sending an email via telnet from the server itself and it
came through fine. Now I'm even more confused! Any idea?

Cheers,

Chris


Just to let people know I have sorted it now. I decided to try COM
interop with the classic CDONTS DLL and it's working fine. Don't have a
clue why though but at least it's sorted now. :)

Chris

Nov 29 '05 #4
"Chris Ashley" <ch***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
What happens if you telnet to port 25 on the server from the server
(within
an RDP window) and try sending an email manually?


Just tried sending an email via telnet from the server itself and it
came through fine. Now I'm even more confused! Any idea?


No :-)

Are you using a different From address? We have hosted servers where mail
sent From domains not hosted with them gets dumped (with no alerts). When
you used telnet, did you definately use the same ip/host to connect as the
script (eg. if the script connects to 123.123.123.123 and you're telnetting
to 127.0.0.1, this may not give a real test).

Nov 29 '05 #5
"Chris Ashley" <ch***********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Just tried sending an email via telnet from the server itself and it
came through fine. Now I'm even more confused! Any idea?


Just to let people know I have sorted it now. I decided to try COM
interop with the classic CDONTS DLL and it's working fine. Don't have a
clue why though but at least it's sorted now. :)


That was my next suggestion ;o)

We seem to have cdonts.dll on most of our 2k3 boxes because someone (not me,
I must add!) must've given up!
Nov 29 '05 #6

Danny Tuppeny wrote:
That was my next suggestion ;o)

We seem to have cdonts.dll on most of our 2k3 boxes because someone (not me,
I must add!) must've given up!


Ho hum. Strange quirks like this make me wonder why I torment myself by
doing this job. :-p

Should have realised that the big difference was that the server was
running 2003 and all our dev machines were running 2000. I guess you
live and learn!

Thanks for the help anyway!

Chris

Nov 29 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Heath | last post: by
1 post views Thread by R0bert Neville | last post: by
5 posts views Thread by lkrubner | last post: by
1 post views Thread by .Net Sports | last post: by
4 posts views Thread by m | last post: by
reply views Thread by =?Utf-8?B?Q2hhcmxlcw==?= | last post: by
2 posts views Thread by Mathew Coleman | last post: by

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.