HI I developed an application to generate a report and the generated report should be emailed to the address given in the config file . Andmy code sends email to outlook only and i as in the live environment there wont be any outlook i want to send it in general . How can i achive this?
public void DCCEmailSetup(DateTime dateRunReport, string path, string messager)
{
toEmailSetup = ConfigurationManager.AppSettings["To mailid"];
fromEmailSetup = ConfigurationManager.AppSettings["From mailid"];
try
{
var message = new MailMessage();
message.To.Add(toEmailSetup);
message.Subject = " Report generated " + dateRunReport;
message.From = new MailAddress(fromEmailSetup);
try
{
message.Attachments.Add(new Attachment(path));
message.Body = messager;
}
catch (Exception e)
{
throw ;
}
var smtp = new SmtpClient(" ");
smtp.Send(message);
}
catch (SmtpException ex)
{
throw new ApplicationException
("SmtpException has occured: " + ex.Message);
}
}