Sendmail not sending

C

chumley

I am taking some stuff from an html form and posting it to a .net mail
component, have weeded out a few token syntax errors, it now looks
like it sends, but i don't see the message in my mailbox.
(e-mail address removed) is a valid email address on the domain i'm using.
Wondering if i'm doing something wrongs in regards to the EventArgs ,
as this file is called post-test.aspx, as that's how i've set the form
action on the previous page :

<%@ Page Language="C#" Debug="true" %>
<%@ Import NameSpace="System.Web.Mail" %>


<script runat="server">

protected void Send_Email(Object Sender, EventArgs e) {
const string SERVER = "relay-hosting.mywebhostsucks.net";
MailMessage Mail = new System.Web.Mail.MailMessage();


Mail.To = "(e-mail address removed)";
Mail.From = "(e-mail address removed)";
Mail.BodyFormat = MailFormat.Text;
Mail.Subject = "Order.net testing";
Mail.Body = Request.Form["email"] + "<br>" + Request.Form
["ordertotal"];

SmtpMail.SmtpServer = SERVER;
SmtpMail.Send(Mail);
Mail = null; // free up resources

Response.Flush();

}
</script>
 
J

John Elliot

Hi,

I don't know the exact answer your question but have an alternate
solution: rather than sending emails to your actual email server and
then wait for it in your INBOX, try eliminating the actual SMTP server
and replace it with a Dummy SMTP server. Check
http://www.aboutmyip.com/AboutMyXApp/DevNullSmtp.jsp

This is a dummy SMTP server that accepts an email and destroys it. It
will also display the SMTP log on the screen that is very helpful in
determining such problems.

If your application can send emails to this dummy server, the problem
could be somewhere else.

JE.
 
A

Alberto Poblacion

chumley said:
I am taking some stuff from an html form and posting it to a .net mail
component, have weeded out a few token syntax errors, it now looks
like it sends, but i don't see the message in my mailbox.
(e-mail address removed) is a valid email address on the domain i'm using.
Wondering if i'm doing something wrongs in regards to the EventArgs ,
as this file is called post-test.aspx, as that's how i've set the form
action on the previous page :

<%@ Page Language="C#" Debug="true" %>
<%@ Import NameSpace="System.Web.Mail" %>


<script runat="server">

protected void Send_Email(Object Sender, EventArgs e) {
const string SERVER = "relay-hosting.mywebhostsucks.net";
MailMessage Mail = new System.Web.Mail.MailMessage();


Mail.To = "(e-mail address removed)";
Mail.From = "(e-mail address removed)";
Mail.BodyFormat = MailFormat.Text;
Mail.Subject = "Order.net testing";
Mail.Body = Request.Form["email"] + "<br>" + Request.Form
["ordertotal"];

SmtpMail.SmtpServer = SERVER;
SmtpMail.Send(Mail);
Mail = null; // free up resources

Response.Flush();

}
</script>

Is that the complete contents of your page? In that case, it's no wonder
your email doesn't get sent. You have written a perfectly fine "Send_Email"
method... but you are never calling it at any time.
Try adding a proper Page_Load event handler, and then call Send_Email
from Page_Load.

Run the page from within Visual Studio, and use the debugger to step
through the method. Verify that SmtpMail.Send() gets called, and that
execution flows to the next statement without throwing an error. If it does,
then the problem lies within the SMTP server.
 

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