PDA

View Full Version : Difficulty emailing from code


Swood
07-11-2004, 01:49 AM
try

SmtpMail.SmtpServer = "localhost";

powell
07-11-2004, 11:16 AM
I am trying to send a mail from a simple .net page. I continually getting an error like:
"The server response was: 553 sorry, that domain isn't in my list of allowed rcpthosts "

If I use a email address within my domain, it works, but for all other email addresses it does not.

Any hints or suggestions greatly appreciated.
Here is my test script :

<%@ Page Language="C#" Debug="true" ContentType="text/html" ResponseEncoding="iso-8859-1" %>

<%@ Import Namespace="System.Web.Mail" %>

<script runat="server">

void Page_Load(Object sender , EventArgs e)

{

SmtpMail.SmtpServer = "mail.mydomain.com";

MailMessage objMailMessage;

string strHTMLBody;

// Create the HTML Message Body

strHTMLBody = "<html><head>" + "<title>Dynamic email</title>" + "</head>[b]" +

"<p>This is a test email<p></body></html>";

// Create the Mail Message

objMailMessage = new MailMessage();

objMailMessage.From = "powell@mydomain.com";

objMailMessage.To = "someexternal@emailaddress.com";

objMailMessage.Subject = "Testing..!?";

objMailMessage.Body = strHTMLBody;

objMailMessage.BodyFormat = MailFormat.Html;

// Send the Mail Message

SmtpMail.Send( objMailMessage );

Response.Write("HTML Email Sent!");

}

</script>

powell
07-12-2004, 08:23 AM
Worked like a charm,
Thanks so much!

Powell

Eric
01-06-2005, 02:50 AM
Please send in a support ticket with details, eg error message...etc

DiscountASP.NET

spire
01-06-2005, 05:45 AM
I am recieving this error when emailing from ms outlook. If I have the person I am sending the email to add me onto their contacts list, the email goes through. At first I thought it was junk mail blocking. But as I was doing research, I found it related to an internal error. Any suggestions would be great.