Asked By
Ivan C Hug
10 points
N/A
Posted on - 10/19/2014
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.
How to Send email through Gmail using c++
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();
}
}Â
}