TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marvin kakuru
1.4k
359
160.8k
email sending failure
Feb 22 2021 7:58 AM
hello forum. am having trouble sending emails from my windows which has been sending emails successfully till mid feb when i started failing to send emails. am getting an error "SmtpException was unhandled"
below is the code i have been using.
private void SendEmail()
{
label10.Text = "100";
label11.Text = "80";
ProgressBar();
string smtAddress = "smtp.mail.yahoo.com";
int portNumber = 587;
bool enableSSL = true;
DateTime dat = DateTime.Parse(label55.Text.ToString());
string emailFrom = label42.Text;
string password = label54.Text;
string emailTo = label44.Text;
string subject = dat.ToString("dd/MM/yyyy") + " - " + label47.Text + " - " + label46.Text;
string body = label45.Text;
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress(emailFrom);
mail.To.Add(emailTo);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
//Attachments
//mail.Attachments.Add(new Attachment("C:\\Import of Used clothing & stationary research.pdf"));
SmtpClient smtp = new SmtpClient(smtAddress, portNumber);
{
smtp.Credentials = new NetworkCredential(emailFrom, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);
}
}
}
Reply
Answers (
5
)
hi guy please share a video about custom attributes for properties in
Sending Mail With Asp.Net WebForm