issues with asp.net mailing

Discussion in 'Programming' started by bm4web, Jan 23, 2010.

  1. #1
    hi,

    please suggest me, i a ma coder, i am using the below code to mail in as.net

    my file is something like mail.aspx

    the code that i am using is

    <% @Page Language="C#" %>
    <% @Import Namespace="System.Web.Mail" %>
    <%
    string strTo = "christophw@fx2.Dev.AlfaSierraPapa.Com";
    string strFrom = "webmaster@aspheute.com";
    string strSubject = "Hi Chris";

    SmtpMail.Send(strFrom, strTo, strSubject,
    "A real nice body text here");

    Response.Write("Email was queued to disk");
    %>

    but it not working!.. :confused:

    let me know do you have any idea..
     
    Last edited: Jan 23, 2010
    bm4web, Jan 23, 2010 IP
  2. bm4web

    bm4web Well-Known Member

    Messages:
    718
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Server Error in '/' Application.
    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>
     
    bm4web, Jan 23, 2010 IP
  3. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    I have a fix for your code, for $5 if that's ok with you.

    <% @Page Language="C#" %>
    <% @Import Namespace="System.Web.Mail" %>
    <%
    String strTo = "christophw@fx2.Dev.AlfaSierraPapa.Com";
    String strFrom = "webmaster@aspheute.com";
    String strSubject = "Hi Chris";

    /*
    SmtpMail.Send(strFrom, strTo, strSubject,
    "A real nice body text here");
    */
    MailMessage message = new MailMessage();
    message.From = strFrom;
    message.To = strTo;
    message.Subject = strSubject;
    message.BodyFormat = MailFormat.Text;
    message.Body = "A real nice body text here";

    try {
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.gmail.com");
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "your_gmail_username@gmail.com");
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "your_gmail_password");
    message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");

    Response.Write("Sending outgoing message<br/>");
    SmtpMail.Send(message);

    } catch(System.Web.HttpException exHttp) {
    Response.Write("Exception occurred: " + exHttp.Message + "<br/>");
    }

    Response.Write("Email was queued to disk<br/>");
    %>
     
    Last edited: Jan 23, 2010
    gapz101, Jan 23, 2010 IP
  4. bm4web

    bm4web Well-Known Member

    Messages:
    718
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    i have got some help from Khalsait and fixed the issue,

    it was the missing of configure file, no issues with coding,

    thanks for your, suggestions, :)
     
    bm4web, Jan 23, 2010 IP