Custom Search
Logiclabz
  • Home
  • C#
  • Send E-Mail with Friendly Display Name in .Net 1.0 (System.Web.Mail)

Send E-Mail with Friendly Display Name in .Net 1.0 (System.Web.Mail)

  

The System.Web.Mail .NET namespace contains classes that used you to send email messages .NET applications using the CDOSYS (Collaboration Data Objects for Windows 2000) message component. The mail message is delivered through the SMTP mail service on an arbitrary SMTP server.

MailMessage provides properties and methods for constructing an e-mail message.
SmtpMail provides properties and methods for sending messages using the Collaboration Data Objects for Windows 2000 (CDOSYS) message component.
MailFormat provides enumerated values for e-mail format.
System.Web.Mail class and their enumeration is Obsolete with System.Net.Mail in Net2.0 Framework.

    try
    {
        //Creating new mail message
        System.Web.Mail.MailMessage MyMail = new System.Web.Mail.MailMessage();

        //Display Name can be sent using following format
        //\<<Friendly Display Name>>\ <mailaddress>"
        MyMail.From = @"\Webtips Emailer\ <admin@webtips.co.in>";

        //To Address
        MyMail.To = "webtips.co.in@gmail.com";

        // BCC Address
        MyMail.Bcc = "somename@someserver.com";

        //Mail Subject
        MyMail.Subject = "Subject Of the mail";

        //Body of the mail
        MyMail.Body = "<html><body>test mail message</body></html>";
        MyMail.BodyFormat = System.Web.Mail.MailFormat.Html;
        
        //SMTP Server name or IP from which mail to be sent
        System.Web.Mail.SmtpMail.SmtpServer = "smtp.someserver.com";

        //Sending Mail
        System.Web.Mail.SmtpMail.Send(MyMail);
    }
    catch
    {
    }



  


Leave a reply


Comments

  • autoversicherungsklassen says:
    Oct 02, 11

    Vary So,however arise right club language music much lead credit standard medical cause many age useful however tour proposal holiday dress sufficient various success i clothes branch poor spirit girl motor establishment contribute inside suitable region respect up within below strategy possibility view crowd left patient time account carefully western everything block drawing red speak plate associate past outside shoot illustrate certain fish home officer kid artist up other nature it bit main method nice degree rise expert lovely nice bind yourself origin least not

  • Thanh says:
    Jan 19, 12

    Great tips, it helps me as I'm still using .NET 1.1



Do you like this post?