Dear Experts,
I have a situation where I need to send the Email to customers using the web service.
I have the details of the customers(i.e. Email ID, Message, Attachmentfilepath etc.) stored in database table,
I could send the mail with attachment, but attachment is not in the format what i sent, it is coming like ATT0007.dat format.
The code is as follows:
BLL objBAL=new BLL();
var list = new List<DTO>();
list = objBAL.getEmailDetails();
foreach (DTO d in list)
{
LinkedResource receiptpath = new LinkedResource(@"C:\Documents and Settings\vp63\Desktop\new.pdf");//Here i have used a static file path rather than using from DB
AlternateView view = AlternateView.CreateAlternateViewFromString(d.Message, null, "text/plain");
receiptpath.ContentId = "InstitutionLogo";
view.LinkedResources.Add(receiptpath);
MailMessage msg = new MailMessage();
msg.AlternateViews.Add(view);
msg.Subject = "Mail";
// msg.Attachments.Add(new Attachment(@"C:\Documents and Settings\vp63\Desktop\logo.PNG"));
//string filename = @"C:\Documents and Settings\vp63\Desktop\new.pdf";
//File file = new File(filename);
//string[] mail = d.NotifiedTo.Split(',');
//for (int index = 0; index <= mail.Length; index++)
//{
// msg.To.Add(new MailAddress(mail[index]));
//}
msg.To.Add(new MailAddress("vijayenderreddy.pailla@gpinfotech.com"));
SmtpClient sc = new SmtpClient();
sc.Send(msg);
Help is Appreciated.
thanks in advance
Vijayenderpailla