sendgrid-apex icon indicating copy to clipboard operation
sendgrid-apex copied to clipboard

Can't seem to access and populate template on SendGrid via Apex

Open seancanny091 opened this issue 11 years ago • 0 comments

Hi,

I've successfully sent an email from SendGrid with parameters passed from SF using the following core code:

SendGrid sendgrid = new SendGrid('username', 'password');
SendGrid.email email = new SendGrid.Email();

email.addTo('[email protected]'); email.setFrom('[email protected]'); email.setSubject('Apex SendGrid Test');

SendGrid.SendGridResponse response = sendgrid.send(email);

I then created a template in SendGrid and attempted to send parameters to it from Salesforce using the following code:

SendGrid sendgrid = new SendGrid('username', 'password');
SendGrid.email email = new SendGrid.Email();

email.addFilter('templates', 'enable', '1'); email.addFilter('templates', 'template_id', '38e0b815-2551-4a9b-aa7a-e74db88329d4');

email.addTo('[email protected]'); email.setFrom('[email protected]'); email.setSubject('Apex SendGrid Test');

SendGrid.SendGridResponse response = sendgrid.send(email);

This processes ok within Salesforce but nothing happens when it gets passed to SendGrid. Any guidance would be much appreciated.

Thanks

seancanny091 avatar Dec 03 '14 19:12 seancanny091