![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello All, I wrote one code for sending mail by using Asp.Net+C#, My code is as follows. private void btnSend_Click(object sender, System.EventArgs e) { try { MailMessage email = new MailMessage(); if(rblHtml.Checked) { email.BodyFormat=MailFormat.Html; } if(rblText.Checked) { email.BodyFormat=MailFormat.Text; } email.From=txtSender.Text; email.To=txtReceiver.Text; email.Subject=txtSubject.Text; email.Body=txtBody.Text; string attach1=null; if(opdAttachment1.PostedFile !=null) { HttpPostedFile ulFile=opdAttachment1.PostedFile; int nFileLen=ulFile.ContentLength; if(nFileLen>0) { strFileName=Path.GetFileName(opdAttachment1.Posted File.FileName); strFileName="attachment/"+strFileName; opdAttachment1.PostedFile.SaveAs(Server.MapPath(st rFileName)); MailAttachment attach=new MailAttachment(Server.MapPath(strFileName)); email.Attachments.Add(attach); attach1=strFileName; } } SmtpMail.SmtpServer="127.0.0.1"; SmtpMail.Send(email); if(attach1 !=null) { File.Delete(Server.MapPath(attach1)); } lblMessage.Text="Your email has been sent successfully"; catch(Exception ex) { lblMessage.Visible=true; lblMessage.ForeColor=Color.Red; lblMessage.Text=ex.ToString(); } When i press "SEND" button, the mail is delivered and i receive message "Your email has been sent successfully". But the mail is not deliver to target destination. The Mail is stored in "C:\Inetpub\mailroot\queue" folder. After some time, it is autometically stored in "Badmail" folder. I use Windows 2000 Professional+.net 1.1 version. I need some solution ... I am relatively new in .net .. Can anybody help me please.. |
![]() |
| Thread Tools | |
| Display Modes | |
| |