Results 1 to 5 of 5

Thread: Code to send e-mail from an ASP.NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Location
    India
    Posts
    8

    Code to send e-mail from an ASP.NET

    Following I write the code to send e-mail from an ASP.NET

    applicationMailMessage mailMess = new MailMessage ();
    mailMess.From = "abc@gmail.com";
    mailMess.To = "xyz@gmail.com";
    mailMess.Subject = "Test email";
    mailMess.Body = "Hi This is a test mail.";
    SmtpMail.SmtpServer = "localhost";
    SmtpMail.Send (mailMess);

    Is this code is write or their need any changes

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Code to send e-mail from an ASP.NET

    Does the email get sent? If so then it's right, otherwise it's not.

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Code to send e-mail from an ASP.NET

    Hi,

    I believe the code in your post is C#. I'll request the mods to transfer this to ASP.NET subforum since the web framework both supports VB.NET and C# languages.

    - kgc
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Code to send e-mail from an ASP.NET

    Thread moved to the 'ASP.Net' forum

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Code to send e-mail from an ASP.NET

    I'm not sure where this thread got moved from but I'd suggest that it belongs in C# because the code posted has nothing specifically to do with ASP.NET. Sending email is the same regardless of the type of application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width