Announcement

Collapse
No announcement yet.

Asp.net email question

Collapse

Ads on showthread pages

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asp.net email question

    WordPress Hosting on SSD Servers
    Hi,

    Can anybody update me how to send emails using Asp.net?


  • #2
    ASP.Net Hosting starts @ $3.18/Mo.
    Hi,

    Here we go...

    Code:
    'Create an instance of the MailMessage class
    Dim objMM as New MailMessage();
    
    'Set the properties
    
    'Provide the recipient address
    objMM.To = "recipient@someone.com"
    
    'Provide your address
    objMM.From = "myaddress@mydomain.com"
    
    'If you want to CC this email to someone then provide it over here
    objMM.Cc = "someone@someaddress.com"
    
    'If you want to BCC this email to someone then provide it over here
    objMM.Bcc = "someone2@someaddress2.com"
    
    'Send the email in text format
    '(to send HTML format, change MailFormat.Text to MailFormat.Html)
    objMM.BodyFormat = MailFormat.Text
    
    'Set the priority - options (High, Low, and Normal)
    objMM.Priority = MailPriority.Normal
    
    'Set the subject
    objMM.Subject = "Hello there!"
    
    'Set the body
    objMM.Body = "Hi, How are you doing?"
    
    'Now, to send the message, use the Send method of the SmtpMail class
    SmtpMail.Send(objMM)
    Make sure that you import the System.Web.Mail namespace in your ASP.NET Web page in order to be able to utilize the above code:
    <% @Import Namespace="System.Web.Mail" %>.

    Hope this helps

    Nici

    Last edited by admin; 08-17-2015, 09:26 AM.

    Comment

    Working...
    X
    Sign up for a News Letter Click here to sign up