Hello ASP.NET programmers;
I've been searching for solutions for Mailing using Gmail not just text but also with attachments.
This code may help but I don't know what language they use to this:
/* yahoo */
public bool SendYahooMail(string sToEmail, string sFromEmail, string sHeader, string sMessage,string Password)
{
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.mail.yahoo.co.in";
client.Port = 587;
// setup Smtp authentication
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(sFromEmail, Password);
client.UseDefaultCredentials = false;
client.Credentials = credentials;
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.From = new MailAddress(sFromEmail);
msg.To.Add(new MailAddress(sToEmail));
msg.Subject = sHeader;
msg.IsBodyHtml = true;
msg.Body = string.Format(sMessage);
try
{
client.Send(msg);
return true;
}
catch (Exception ex)
{
return false;
}
}
/* Gmail*/
public bool SendGmailMail(string sToEmail, string sFromEmail, string sHeader, string sMessage,string Password)
{
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;
// setup Smtp authentication
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(sFromEmail, Password);
client.UseDefaultCredentials = false;
client.Credentials = credentials;
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.From = new MailAddress(sFromEmail);
msg.To.Add(new MailAddress(sToEmail));
msg.Subject = sHeader;
msg.IsBodyHtml = true;
msg.Body = string.Format(sMessage);
try
{
client.Send(msg);
return true;
}
catch (Exception ex)
{
return false;
}
}
//
Please guide me using ASP.NET and C# as they related.
and also please help me about the FTP server which is hard for me to understand (like filezilla?).
do I need free hosting for this Project?
Can this Auto Mail be done using ASP.NET and C#?
-Zelrick