4
Answers

How to attach document files to the mails by using sendgrid

Dawood Abbas

Dawood Abbas

5y
7.9k
1
I would like to attach some files which are at uploading time, but not getting emails where I could save the files everything is good to run.
 
public ContentResult CompleteAssignedTask(int AssignedTaskId, string FromEmail, string[] fileNames)
{
var client = new SendGridClient("mycode");
var from = new EmailAddress("[email protected]", "The SaharaCRM");
var to = new EmailAddress(customer.Email, customer.CustName);
var htmlContent = body;
var msg = MailHelper.CreateSingleEmail(from, to, taskRecord.Subject, "", htmlContent);
msg.AddAttachments(fileNames);
var response = client.SendEmailAsync(msg);
Answers (4)