What is happening is that:
i am sending a mail with attachment(image).
Suppose i am sending mail to abc@expogp.com,
vijaya@expogr.com,rahul@expogp.com,xyz@gmail.com.
They are getting the mails but the problem is when they are trying to open the attatched image it hsows the below window:
This file cannot be previewed because of the following error: Microsoft office outlook image previwer.
In gmail account also,the image is not showing when tried to open it.
The strange thing is that for some people it displays the attatched image.
What will be the issue?
screenshots:
SmtpClient smtp = new SmtpClient
{
Host = myhost, // smtp server address here…
Port = p,
EnableSsl = false,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new System.Net.NetworkCredential(eid, pw),
//Timeout = 30000,
};
string from = ddlemails.SelectedItem.ToString();
int idno = -1;
string mssg = txtmsgbody.Text;
string myString = Server.HtmlDecode(mssg);
string fromname = txtfrom.Text;
foreach (string email in emails)
{
string SendEmail = email;
idno = idno + 1;
try
{
MailMessage message = new MailMessage(from, SendEmail, txtsubject.Text, myString);
message.From = new MailAddress(from, fromname);
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
message.Headers.Add("Disposition-Notification-To", from);
message.IsBodyHtml = true;
if (fuAttach.HasFile)
{
filename = Path.GetFileName(fuAttach.PostedFile.FileName);
fuAttach.SaveAs(Server.MapPath("~/expo_crm/Attachments/" + filename));
Attachment data = new Attachment(fuAttach.PostedFile.InputStream, filename);
message.Attachments.Add(data);
}
smtp.Send(message);
object userid = user_ids[idno];
Int32 uid = Convert.ToInt32(user_ids[idno]);
sent_user_ids.Add(uid);
}
catch (Exception ex)
{
errorno++;
object userid = user_ids[idno];
Int32 uid = Convert.ToInt32(user_ids[idno]);
Notsent_user_ids.Add(uid);
}
}