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

Suggested improvement to documentation

Open ambrosechapel opened this issue 11 years ago • 0 comments

I just spent a little time figuring out how to do what SendGrid calls "substitutions", which isn't in the POD.

If you put template objects into your 'html' value in the call to new(), they can be replaced with variables at the time of sending, e.g.:

my $sg = Email::SendGrid->new(
    ## other stuff
    html => '<a href="-SomeWebsite-">click here</a>'
);

then you use the addSubVal method to specify the replacement content.

$sg->header->addSubVal( '-SomeWebsite-' => 'http://google.com' );

and the tag will be replaced in the rendered email sent:

<a href="http://google.com">click here</a>

I suggest you add this to the documentation.

ambrosechapel avatar Apr 15 '15 02:04 ambrosechapel