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
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