Emails seemingly disappearing.. very strange problem

C

Chris Ashley

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
 
D

Danny Tuppeny

Chris Ashley said:
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?
 
C

Chris Ashley

Danny said:
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
 
C

Chris Ashley

Chris said:
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
 
D

Danny Tuppeny

Chris Ashley said:
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).
 
D

Danny Tuppeny

Chris Ashley said:
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!
 
C

Chris Ashley

Danny said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top