Skip to content

Latest commit

 

History

History

OLT.FluentEmail.SendGrid

fluent email logo

This package add provides an Advanced SendGrid Sender for FluentEmail

See FluentEmail (jcamp version) for more information

Send SendGrid Template via the SendGrid API with additional options

  • DisableClickTracking
  • DisableOpenTracking
  • CustomArgs
  • UnsubscribeGroupId
public class EmailService {

   private IFluentEmail _fluentEmail;

   public EmailService(IFluentEmail fluentEmail) {
     _fluentEmail = fluentEmail;
   }

   public async Task Send() {
    var myTemplateJson = new MyTemplateClass();

    var result = await _fluentEmail
        .To("[email protected]")

        // NOTE: You do not have to provide template data, you can pass null
        .SendWithTemplateAsync("d-templateIdHere", myTemplateJson, opts =>
        {
            opts.DisableClickTracking = true;
            opts.DisableOpenTracking = true;
            opts.CustomArgs.Add("CustomArgName", "ArgValue");
            opts.UnsubscribeGroupId = 123456;
        });
   }
}