Ep

Ep

How to Send an Anonymous Email using Gmail in ASP.Net

how to send a text from email, send an email, send anonymous email, i want to send an email,send email to,send email to text, hotmail login, send text from email
Send an Email

Send Text From Email - C#

In this article you will find the simplest way to send email from Gmail, Hotmail and Yahoo! in C#. You just need to have correct SMTP address. For example:-


Server Name
SMTP Address
Port
SSL
Yahoo!
smtp.mail.yahoo.com
587
Yes
GMail
smtp.gmail.com
587
Yes
Hotmail
smtp.live.com
587
Yes

Sample Code
using System.Net.Mail; 

protected void SendEmail()
    {
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com";
        smtp.Port = 587;
        smtp.Credentials = new      System.Net.NetworkCredential("from@gmail.com", "Password");
        smtp.EnableSsl = true;

        MailMessage msg = new MailMessage();
        msg.Subject = "Demo";
        msg.Body = "Hi there..";

        string toAddress = "toaddress@domain.com"; // Add Recepient address
        msg.To.Add(toAddress);

        string fromAddress = "\"no reply \" <from@gmail.com>";
        msg.From = new MailAddress(fromAddress);
        msg.IsBodyHtml = true;

        try
        {
            smtp.Send(msg);
        }
        catch
        {
            throw;
        }
    }

I hope you will enjoy the development tips while programming with asp.net using C#. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome. 

Also If you like this article, don't forget to share this article with your friends and colleagues.
How to Send an Anonymous Email using Gmail in ASP.Net Reviewed by Ravi Kumar on 6:04:00 PM Rating: 5

3 comments:

  1. Nice code! It was helpful in developing my sample application hosted on github here

    https://github.com/fredo007/i6technology/tree/master/InsuranceSales.

    I've also created a tutorial showing my approach to integrating gmail into an asp.net mvc4 application using dependency injection with Autofac.

    http://prestoasp.net/how-to-send-email-using-gmail-smtp-in-an-asp-net-mvc-application/

    ReplyDelete
    Replies
    1. nice work fredo.. :)
      and keep visiting for more articles.

      Delete

All Rights Reserved by Etechpulse © 2012 - 2017
Powered By Blogger

Contact Form

Name

Email *

Message *

Powered by Blogger.