Click here to Skip to main content
11,411,263 members (72,687 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi All ,

I have send mail using asp.net .. i have send mail with the message body
string LinkName = " here ";

MailBody = "Please Update Data here " + LinkName
clsMailHelper.SendMailMessage1(FrommailAddress, TomailAddress, "", "", MailSub..., MailBody);

in this link web page is opened .. but i want to work without opening web form.

please help me for this.

public class clsMailHelper
{
   /// <summary>
   /// Sends an mail message
   /// </summary>
   /// <param name="from">Sender address</param>
   /// <param name="to">Recepient address</param>
   /// <param name="bcc">Bcc recepient</param>
   /// <param name="cc">Cc recepient</param>
   /// <param name="subject">Subject of mail message</param>
   /// <param name="body">Body of mail message</param>
   public static void SendMailMessage1(string from, string to, string bcc, string cc, string subject, string body)
   {
      // Instantiate a new instance of MailMessage
      MailMessage mMailMessage = new MailMessage();
 
      // Set the sender address of the mail message
      mMailMessage.From = new MailAddress(from);
      // Set the recepient address of the mail message
      mMailMessage.To.Add(new MailAddress(to));
 
      // Check if the bcc value is null or an empty string
      if ((bcc != null) && (bcc != string.Empty))
      {
         // Set the Bcc address of the mail message
         mMailMessage.Bcc.Add(new MailAddress(bcc));
      }      // Check if the cc value is null or an empty value
      if ((cc != null) && (cc != string.Empty))
      {
         // Set the CC address of the mail message
         mMailMessage.CC.Add(new MailAddress(cc));
      }       // Set the subject of the mail message
      mMailMessage.Subject = subject;
      // Set the body of the mail message
      mMailMessage.Body = body;
 

      // Set the format of the mail message body as HTML
      mMailMessage.IsBodyHtml = true;
      // Set the priority of the mail message to normal
      mMailMessage.Priority = MailPriority.Normal;
 
      // Instantiate a new instance of SmtpClient
      //SmtpClient mSmtpClient = new SmtpClient();
      SmtpClient mSmtpClient = new SmtpClient("mail.myport.com");
 
      // Send the mail message
      mSmtpClient.Send(mMailMessage);
   }
}

add following code in config file

<system.net>
        <mailSettings>
            <smtp from="vilas.jadhav@myport.com">
                <!--<network host="smtp.myport.com" port="25" userName="vilas.jadhav" password="xyz@0909"/>-->
                <network host="mail.myport.com" userName="vilas.jadhav" password="myport@123"/>
            </smtp>
        </mailSettings>
    </system.net>




Thanks
vilas
Posted 11-Feb-13 22:42pm
Mogya1.6K
Comments
Irbaz Haider Hashmi at 12-Feb-13 3:56am
   
You can't.
source.compiler at 12-Feb-13 4:12am
   
can give a link to user with email and the link take user to a page ! and page operate any operation, then before page load(for example all of codes come in InitComplete event) transfer user to another page ?! with this user cant see operating page!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 149
1 Sascha Lefévre 110
2 OriginalGriff 103
3 Dave Kreskowiak 80
4 Maciej Los 78
0 Sergey Alexandrovich Kryukov 8,920
1 OriginalGriff 6,983
2 Maciej Los 3,430
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100