Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
When I log into my WebApplication i would like to be also automatically logged into Gmail. Exactly like I would go to gmail.com and typed my e-mail address and password myself.
It has to be done on client's side thus one must use Java Script. Let's make a premiss that we already know login and password:
function LoginGmail(login, password) {
}
Question: How to login to Gmail via Java Script?
I could not get your question clearly but what I think is that you want to send an email to someone by C# code. Here is the code which you can use.
SmtpClient client = new SmtpClient();
MailMessage msg = new MailMessage();
MailAddress to = new MailAddress("client email address");
MailAddress from = new MailAddress("Your Email Address");
msg.IsBodyHtml = true;
msg.Subject = "Mail Title";
msg.To.Add(to);
msg.Body = "Your message";
msg.From = from;
client.Send(msg);
In web.config file under configuration section, you need to write the credential information of your mail account
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.gmail.com" port="587" userName="your email address" password="your password" defaultCredentials="false" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>