By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,685 Members | 1,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,685 IT Pros & Developers. It's quick & easy.

mail Attachment program in c#

P: n/a
MailMessage objMail = new MailMessage();
MailAttachment objAttach;// = new MailAttachment();
string strPath = "";
try
{
strPath =
System.IO.Path.GetFileName(File1.PostedFile.FileNa me);
}
catch (Exception ex)
{
Response.Write("Error ==>" + ex.Message);
}
objMail.From = txtFrom.Text;
objMail.To = txtTo.Text;
objMail.Subject = txtSubject.Text;
objMail.Body = txtBody.Text;
if (ddlPriority.SelectedValue == "Low")
{

objMail.Priority = MailPriority.Low;
}
else if (ddlPriority.SelectedValue == "Normal")
{
objMail.Priority = MailPriority.Normal;
}
else
{
objMail.Priority = MailPriority.Low;
}
objMail.Cc = txtCC.Text;
objMail.Bcc = txtBCC.Text;

objAttach = new MailAttachment(strPath);
objMail.Attachments.Add(objAttach);
SmtpMail.Send(objMail);

when i use it gives an error invalid attachments what is its cause?

Jun 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
<vi******@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
strPath = System.IO.Path.GetFileName(File1.PostedFile.FileNa me);
when i use it gives an error invalid attachments what is its cause?
http://www.systemwebmail.com/faq/2.3.aspx
--
http://www.markrae.net

Jun 2 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.