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

Discussion in 'ASP .Net' started by tfsmag, Oct 21, 2005.

  1. tfsmag

    tfsmag Guest

    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="";
    string From=youremail.Text;
    string Subject=yoursubject.SelectedValue.ToString();
    string Body=yourcomments.Text;
    string username="";
    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" />

    -------------------------------------
     
    tfsmag, Oct 21, 2005
    #1
    1. Advertising

  2. tfsmag

    Terry Olsen Guest

    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.

    "tfsmag" <> wrote in message
    news:...
    > 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="";
    > string From=youremail.Text;
    > string Subject=yoursubject.SelectedValue.ToString();
    > string Body=yourcomments.Text;
    > string username="";
    > 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" />
    >
    > -------------------------------------
    >
     
    Terry Olsen, Oct 21, 2005
    #2
    1. Advertising

  3. tfsmag

    Kevin Frey Guest

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

    "tfsmag" <> wrote in message
    news:...
    > 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="";
    > string From=youremail.Text;
    > string Subject=yoursubject.SelectedValue.ToString();
    > string Body=yourcomments.Text;
    > string username="";
    > 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" />
    >
    > -------------------------------------
    >
     
    Kevin Frey, Oct 21, 2005
    #3
  4. tfsmag try looking through this site at:-
    http://www.systemwebmail.com/
    It should giude you
    Hope that helps
    Patrick

    "tfsmag" <> wrote in message
    news:...
    > 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="";
    > string From=youremail.Text;
    > string Subject=yoursubject.SelectedValue.ToString();
    > string Body=yourcomments.Text;
    > string username="";
    > string password="*******";
    >
    > MailMessage mail = new MailMessage();
    > mail.To = To;
    > mail.From = From;
    >

    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenti
    cate",
    > 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" />
    >
    > -------------------------------------
    >
     
    Patrick.O.Ige, Oct 21, 2005
    #4
  5. 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...





    "tfsmag" wrote:

    > 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="";
    > string From=youremail.Text;
    > string Subject=yoursubject.SelectedValue.ToString();
    > string Body=yourcomments.Text;
    > string username="";
    > 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" />
    >
    > -------------------------------------
    >
    >
     
    =?Utf-8?B?U3JlZWppdGggUmFt?=, Oct 21, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    55,605
  2. Replies:
    5
    Views:
    415
    Kevin McMurtrie
    Mar 20, 2005
  3. Replies:
    0
    Views:
    1,484
  4. Replies:
    2
    Views:
    1,081
    A. Sinan Unur
    May 25, 2006
  5. Ryan
    Replies:
    5
    Views:
    108
Loading...

Share This Page