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
Pravin Ghadge
563
2.1k
587.4k
Error:Failure sending mail.
Dec 9 2010 7:23 AM
Hi I have used gmail for sending mail localy which worked fine but when i uploaded the same file on server the "Failure sending mail."
My code is:
MailMessage
mm =
new
MailMessage
(
"
[email protected]
"
,
"
[email protected]
"
);
mm.Subject = txtSubject.Text;
mm.Body =
"Name: "
+ txtName.Text +
"<br /><br />Email: "
+ txtEmail.Text +
"<br />"
+ txtBody.Text;
if
(FileUpload1.HasFile)
{
string
FileName = System.IO.
Path
.GetFileName(FileUpload1.PostedFile.FileName);
mm.Attachments.Add(
new
Attachment
(FileUpload1.PostedFile.InputStream, FileName));
}
mm.IsBodyHtml =
true
;
SmtpClient
smtp =
new
SmtpClient
();
smtp.Host =
"smtp.gmail.com"
;
smtp.EnableSsl =
true
;
System.Net.
NetworkCredential
NetworkCred =
new
System.Net.
NetworkCredential
();
NetworkCred.UserName =
"
[email protected]
"
;
NetworkCred.Password =
"xxxxx"
;
smtp.UseDefaultCredentials =
true
;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
lblMessage.Text =
"Email Sent SucessFully."
;
Reply
Answers (
1
)
problem on image retrieve from Database to Image control
Exception in Queue while removing an element ?