V
vinodkus
MailMessage objMail = new MailMessage();
MailAttachment objAttach;// = new MailAttachment();
string strPath = "";
try
{
strPath =
System.IO.Path.GetFileName(File1.PostedFile.FileName);
}
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?
MailAttachment objAttach;// = new MailAttachment();
string strPath = "";
try
{
strPath =
System.IO.Path.GetFileName(File1.PostedFile.FileName);
}
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?