1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Email from C# windows application

Discussion in 'C#' started by mymindrules, Sep 23, 2013.

  1. #1
    Hello People

    I want to send email from windows desktop application which I am creating in visual studio using language c#. Can anyone tell me how can i send email using windows app?
    SEMrush
     
    mymindrules, Sep 23, 2013 IP
    SEMrush
  2. seotraining

    seotraining Active Member

    Messages:
    511
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #2
    You can use gmail api for it here is the code for it
    MailMessage m = new MailMessage("mailidofSender", To);
                m.Subject = Subject;
                m.Body = Body;
                m.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "mail.google.com";
                NetworkCredential authinfo = new NetworkCredential("mailidfrom", "YourPassword");
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = authinfo;
                smtp.Send(m);
    
    Code (markup):
     
    seotraining, Sep 24, 2013 IP
    mymindrules likes this.