... other than you guys here?
I'm working on a new function in my WinForms C# application to send an email. I send emails in this app all the time but how it works is we have a table called xtblMessages and I just write a row into the table that has a subject, message body, recipient, etc. and some program that somebody else wrote processes the table. What I need to do this time is attach an Excel file, and the table doesn't support that.
I've emailed the author of that code twice today but he hasn't replied, so I was wondering if this is something I can just figure out, or if I need him or our other IT person to tell me what goes here?
Even if it's just temporary to flesh everything out and I change it later, if I could get this to work I'd be making progress. I didn't know if I could use my own personal gmail account while testing, but I wasn't thrilled about putting my personal password here: MailClient.Credentials = new System.Net.NetworkCredential("account2@gmail.com", "password") even temporarily.
Thanks for any tips.
I'm working on a new function in my WinForms C# application to send an email. I send emails in this app all the time but how it works is we have a table called xtblMessages and I just write a row into the table that has a subject, message body, recipient, etc. and some program that somebody else wrote processes the table. What I need to do this time is attach an Excel file, and the table doesn't support that.
I've emailed the author of that code twice today but he hasn't replied, so I was wondering if this is something I can just figure out, or if I need him or our other IT person to tell me what goes here?
Code:
try
{
//do submit
MailMessage emailMessage = new MailMessage();
emailMessage.From = new MailAddress("account2@gmail.com", "Account2");
emailMessage.To.Add(new MailAddress("account1@gmail.com", "Account1"));
emailMessage.Subject = "SUBJECT";
emailMessage.Body = "BODY";
emailMessage.Priority = MailPriority.Normal;
SmtpClient MailClient = new SmtpClient("smtp.gmail.com");
MailClient.Credentials = new System.Net.NetworkCredential("account2@gmail.com", "password");
MailClient.Send(emailMessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Thanks for any tips.