so what the heck am i doing wrong on sending mail through ASP.net

T

tfsmag

It acts like it sends, but nothing ever shows up... anything you guys
can find glaringly wrong here?

Thanks in advance,
Jeff

Here is the code that is supposed to send the mail.

-------------------------------------

private void submit_cf_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
string To="(e-mail address removed)";
string From=youremail.Text;
string Subject=yoursubject.SelectedValue.ToString();
string Body=yourcomments.Text;
string username="(e-mail address removed)";
string password="*******";

MailMessage mail = new MailMessage();
mail.To = To;
mail.From = From;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
1);
mail.Fields.Add("http://schemas.micro

soft.com/cdo/configuration/sendusername", username);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
password);
mail.Subject = Subject;
mail.Body = Body;
SmtpMail.SmtpServer = "mail.twentyfoursevenmag.com"; //your real
server goes here
SmtpMail.Send(mail);
}

----------------------------------------

Here is the aspx code that sends it

----------------------------------------

<asp:TextBox CssClass="textboxes" id="yourname" runat="server"
/>Name<br>
<asp:TextBox CssClass="textboxes" id="youremail" runat="server"
/>Email<br>
Subject<br>
<asp:DropDownList class="textboxes" id="yoursubject"
runat="server">
<asp:ListItem Value="Misc. Inquiry From TFSmag Contact
Form">Misc.</asp:ListItem>
<asp:ListItem Value="I love TFSmag so much it hurts">I love
you</asp:ListItem>
<asp:ListItem Value="I hope TFSmag gets hit by a dump truck">I
hate you</asp:ListItem>
<asp:ListItem Value="Dear TFSmag, please link my site">Link
Exchanges</asp:ListItem>
<asp:ListItem Value="Dear TFSmag, i wanna give you
money">Advertising</asp:ListItem>
</asp:DropDownList>
<br>
<asp:TextBox CssClass="textboxes" id="yourcomments"
TextMode="MultiLine" runat="server" Columns="25"
Rows="6">comments
</asp:TextBox><br>
<asp:ImageButton ImageUrl="images/submitbutton.png" ID="submit_cf"
Runat="server" />

-------------------------------------
 
T

Terry Olsen

Make sure you have added a reference to System.Web.dll to your project.
I've found that without the reference, it will act like it sends (no
exceptions) but doesn't actually do anything.
 
K

Kevin Frey

I believe CDONTS must be installed on the system, as these routines delegate
to it. Is CDONTS installed?
 
G

Guest

This may not be the code..

Have you checked the Inetpub\mailroot folder in this SMTP server ? any files
in badmail /queue folders?

Also you may find some errors/warnings by SMTP Service in the Event Log of
this SMTP Server...

The Send command only delivers the email to the SMTP folders and rest is the
job of SMTP Server. Thats why you dont see any error even when the mails are
not delivered.

if you are inside a corporate network, some external emails may be blocked
by firewall.. try is the emails to interal addresses work...
 

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