469,927 Members | 1,832 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Mails are stuck in the Queue Folder

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..

Jul 23 '05 #1
1 4353

"Kalpesh" <ka************@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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..


You'll probably get a better response in a .NET or ASP group rather than a
SQL Server one.

Simon
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Brent Burkart | last post: by
1 post views Thread by Yazeed | last post: by
2 posts views Thread by beeswax | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.