send email from my C# asp.net form

Last post 06-04-2008 5:21 AM by tasnim5. 4 replies.

Sort Posts:

  • send email from my C# asp.net form

    06-04-2008, 2:21 AM
    • Participant
      793 point Participant
    • anupalavila
    • Member since 01-03-2008, 11:25 AM
    • Kerala, India
    • Posts 375

     Hai

     I am new to asp.net.how can I send email from my C# asp.net form

     

    Thanks in advance

    Anu Palavila 

    Please: Don't forget to click Mark as Answer on the post that helped you. That way future readers will know which post solved your issue.

    Regards
    Anu Palavila
  • Re: send email from my C# asp.net form

    06-04-2008, 5:11 AM
    • Participant
      884 point Participant
    • murthysrn
    • Member since 12-15-2006, 5:22 AM
    • Bangalore
    • Posts 314

    include

    //---------------------------------------------------------------------------

    using System.Web.Mail;

    public static string SendMail(int pintUserID, string pstrMailTo, string pstrMailBcc,string pstrMailCc,string pstrMailSubject,string pstrMailBody,string pstrAttachFilePath)

    {

    try

    {

    MailMessage objMail = new MailMessage();

    objMail.From = System.Configuration.ConfigurationSettings.AppSettings["FromEmailID"];

    //objMail.From =System.Web.HttpContext.Current.Session["OfficeEmailID"].ToString() ;

    objMail.To = pstrMailTo;

    objMail.Bcc = pstrMailBcc;

    objMail.Cc = pstrMailCc;

    objMail.Subject = pstrMailSubject;

    MailAttachment Attachment = null;if (File.Exists(pstrAttachFilePath))

    {

    Attachment =
    new MailAttachment(pstrAttachFilePath);

    }

    objMail.Attachments.Add(Attachment);

    SmtpMail.SmtpServer = "localhost";//System.Configuration.ConfigurationSettings.AppSettings["SMTPServerIP"];

    SmtpMail.Send(objMail);return "TRUE";

    }

    catch(Exception Ex)

    {

    return Ex.Message;

    }

    }

     

     

    Config file

    <add key="SMTPServerIP" value="192.168.1.11"></add>

     

     call the function SendMail  & enable your system SMTP server.

     

    Thanks & Regards,
    Murthy.
  • Re: send email from my C# asp.net form

    06-04-2008, 5:13 AM
    Answer
    • Participant
      1,339 point Participant
    • Mahadeomatre
    • Member since 04-23-2007, 11:00 AM
    • Pune, India
    • Posts 230
    Thanks,
    Mahadeo

    -----------------------------------------------
    Best is Not the END point, but a starting point for Innovation
    ------------------------------------------------
    Remember to mark posts as the "Answer" to help future users.
  • Re: send email from my C# asp.net form

    06-04-2008, 5:19 AM

     Hope these links can help U

    http://www.asp101.com/Samples/email_html_aspx.asp

    http://download.microsoft.com/download/d/f/c/dfc7a022-3426-4868-b23c-3818a6e54305/HtmlEmail.zip

    ~JJ

    www.mReach.Net ...for Online Live TV Channels, Radio's and WebCams Live

    Online Live TV Channels, Radio's and WebCams
  • Re: send email from my C# asp.net form

    06-04-2008, 5:21 AM
    • Participant
      1,667 point Participant
    • tasnim5
    • Member since 06-08-2006, 12:24 AM
    • Mumbai, India
    • Posts 276

    Hello dear,

    Pl;ease refer to the links below:

    http://www.codeproject.com/KB/aspnet/Email_Sending_Programme.aspx

    http://www.codersource.net/csharp_sending_emails.aspx

    Regards,

    Ahmad

    "Please mark as answered if it is helpful to you". Thank you

    Regards,
    Ahmed

    ***************************************************
    Please don't forget to mark the post as Answer, which helps you.

    Thank you.
    www.ahmadtasnim.com
Page 1 of 1 (5 items)