Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
When a large file size ( typically > 1 MB ) is sent as an Email attachment through Workflow, we might see timed out exception. The exact error message is “System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage)”
To overcome this, rather than just sending email via SMTP, pickup directory can be used in which case the IIS takes the responsibility of delivering the emails with attachment.
SmtpClient client = new SmtpClient();
client.Host = "hostname";
client.Port = 2095;
client.Credentials = new System.Net.NetworkCredential("username", "password");
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
MailAddress from = new MailAddress(“FromEmailID”);
MailAddress to = new MailAddress("ToEmailID”);
// Specify the file location
Attachment att1 = new Attachment("
c:\\Test.doc");
MailMessage msg = new MailMessage(from, to);
msg.Subject = "
Mail Test Success...";
msg.Attachments.Add(att1);
msg.Body = "
some text for message body";
try
{
client.Send(msg);
MessageBox.Show("
Mail Was Sent Successfully...");
}
catch (Exception ex)
{
//Exception Handling Mechanism
}
Please sign in to use this experience.
Sign in