I am trying to send email using the EmailButton_Click code. However I am getting the error on this line smtp.Send(mailMessage)
The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.'
Can someone help me fix it please?
The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.'
Can someone help me fix it please?
protectedvoid EmailButton_Click(object sender, EventArgs e)
{//get selected email
EmailButton.Visible = true;string requestor = RequestorDropDownList.SelectedValue.ToString();string message = "The following records have been prepped for processing. Valid cases will be processed.";if (requestor.Length >0)
message = string.Format(message);using (MailMessage mailMessage = new MailMessage())
{
mailMessage.From = new MailAddress("NoReply_FTA@courts.state.mn.us");//Uncomment after testing in Deve June 2019
MailAddress to = new MailAddress(requestor);
mailMessage.To.Add(to);string ccEmailAddress = "okaymy1112@mail.com";if (ccEmailAddress.Length >0)
{
MailAddress ccto = new MailAddress(ccEmailAddress);
mailMessage.CC.Add(ccto);
}
mailMessage.Subject = "FTA Case Reset Notice";
mailMessage.Body = message;
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.Send(mailMessage);//Error on this line
}string msg = "No batches were found";
Response.Write("<script>alert('" + msg + "')</script>");
}