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
Susanta Rout
787
1.1k
125.3k
problem in sending email with attachment
Sep 10 2015 7:56 AM
button click event
protected void btnUpload_Click(object sender, EventArgs e)
{
string filepath;
if(resumeUpload.HasFile)
{
filepath = resumeUpload.PostedFile.FileName;
string body = "My Name :" + txtNamec.Text + "<br/>I am a" + ddlGender.SelectedItem.Text + "<br/>My Email :" + txtEmailc.Text + "<br/>My Mobile No :" + txtMobile.Text + "<br/> Course :" + txtCourse.Text + "<br/> Location" + txtLocation.Text;
Label1.Text = sv.carrer(body,filepath);
}
}
my class
public string carrer(string email,string filepath)
{
try
{
string to = "
[email protected]
";
string from = "
[email protected]
";
MailMessage msg = new MailMessage(from, to);
string mailbody = email;
msg.Subject = "Smart Vidyarthi Call Back";
msg.Body = mailbody;
msg.Attachments.Add(new Attachment(filepath));
msg.BodyEncoding = Encoding.UTF8;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
System.Net.NetworkCredential basicredenital = new System.Net.NetworkCredential("
[email protected]
", "password");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = basicredenital;
client.Send(msg);
return "Message Has Been Sent";
}
catch (Exception ex)
{
throw ex;
}
}
exception: file not found eception
Reply
Answers (
17
)
Facebook like website
How to access content page controls from content page??