sample email code

Discussion in 'Getting started' started by Bluegolden, Oct 7, 2012.

  1. Good afternoon code Gurus

    Can anyone provide a simple working example of sending email from this server using vb.net 4

    Thanks,
    Blue
     
  2. dmitri

    dmitri DiscountASP.NET Staff

  3. Thanks. I did read that first before posting but it seems to be all about ASP.NET 2.0. So are you saying that this should work fine in Asp.net4?

    Thanks
     
  4. Thank you dmitri,

    Works great!
     
  5. martino

    martino DiscountASP.NET Staff

    Yes, the code should still work in ASP.NET 4 :D

    We also have a knowledge base article that shows you how to use our mail servers SMTP service to send out messages from your web application. The knowledge base can be found here: http://support.discountasp.net/KB/a1060/how-to-send-email-in-aspnet-20-smtp-authentication.aspx

    Notice that you have to authenticate against the SMTP service on the mail server in order to send out the email message. You will need to authenticate with one of your email users that you have created on the mail server.
     
  6. The email related namespaces have not changed and there are no new features. Its the same thing. By using a newer framework, you are getting additional features namespaces, performance improvements etc. But things like sending mail etc, wont be affected. This allows for migration upward while maintaining backward comparability. Well most the time ;)
     
  7. Inserting a link into the email

    Hi All,

    Thanks again to Dmitri for providing an excellent link for code to send email from the host server.

    This is working fine, but I want to insert a hyperlink into the body of the email and can not find a code example or make the object model work to insert a link into the body. Can anyone provide an example?

    Thanks
    Blue
     
  8. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Hi Blue,

    What's the exact problem you're having? The body of the text is a string variable so you should be able to store something like:

    <A HREF="http://www.mydomain.com">http://www.mydomain.com</A>

    If you're having trouble escaping characters, please see this link:

    http://msdn.microsoft.com/en-us/library/4edbef7e.aspx

    I'm not a VB expert, but I know in C#, you can escape an entire string by using the '@' symbol.

    For example:

    String Email.Body = @"<A HREF="http://www.mydomain.com">http://www.mydomain.com</A>";

    I'm not sure if there is a functional equivalent in VB.
     

Share This Page