How to Send email through Gmail using c++

Asked By 10 points N/A Posted on -
qa-featured

I would like to could e-mail through Gmail with C, the configured e-mail from a desktop mail client to use a Gmail account to send, send. I looked a bit like jwSMTP popen and sendmail, but those look like they only work if the host is a mail server. I know that this job is a good way to go in Python, but I’ve never tried it in C.

SHARE
Answered By 0 points N/A #187957

How to Send email through Gmail using c++

qa-featured

Try to create in ASP.NET. I hope it works for you.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Net.Mail;

using System.Net;

namespace ConsoleApplication2

{
    
class Program
   
 {
       
 static void Main(string[] args)
       
 {
           
 var client = new SmtpClient("smtp.gmail.com", 587)
          
  {
                
Credentials = new NetworkCredential("[email protected]", "mypwd"),
               
 EnableSsl = true
          
  };
           
 client.Send("[email protected]", "[email protected]", "test", "testbody");
           
 Console.WriteLine("Sent");
            
Console.ReadLine();
      
  }
   
 } 

}

Login/Register to Answer

Related Questions