private void MailSend() { DateTime Now = System.DateTime.Now; MailMessage message = new MailMessage(); SmtpClient smtp = new SmtpClient("corimc04"); smtp.Timeout = 5000; string recipient = recipientCB.SelectedItem.ToString(); try { var _with1 = message; _with1.From = new MailAddress("Non-Stock_MRO_Administrator@gmail.com"); _with1.To.Add(new MailAddress(email)); _with1.Body = "You have a package in receiving ready for pickup from " + supplier + ".\nOn Shelf: " + shelf + ".\nTracking Number: " + trackingNum; _with1.Subject = "MRO Automated Email for " + recipient; smtp.Send(message); message = null; } catch (Exception ex) { MessageBox.Show("Error Sending emails. " + ex.Message); } smtp = null; return; }
Sub SendEmail() Dim smtp As New SmtpClient("corimc04") smtp.UseDefaultCredentials = True smtp.Timeout = 5000 Try Dim message As New MailMessage() Dim _with1 = message _with1.From = New MailAddress("Rework_Reporter@gmail.com") _with1.To.Add(New MailAddress("email")) _with1.Body = "Rework Status for Rework WIP" & vbLf & data _with1.Subject = "Rework Report Updates" smtp.Send(message) message.Dispose() Catch ex As Exception Console.WriteLine("Error Sending emails. " & ex.Message) End Try smtp = Nothing End Sub
smtp.UseDefaultCredentials = True
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)