I am using the Email::SendGrid::V3 Perl library and my goal is to send one e-mail to many recipients by greeting them using their first name. I however cannot figure out how to perform the personalization using their online documentation:
https://metacpan.org/pod/Email::SendGrid::V3#$self-%3Eset_section($key,-$value);
I can send a single email to two different persons but I lack information on how to approach the body substitutions.
use Email::SendGrid::V3;
my $sg = Email::SendGrid::V3->new(api_key => 'ABCDE');
my $result = $sg->from('[email protected]')
->subject('This is a subject line')
->add_envelope( to => [ {email => '[email protected]', name => 'John Smith' }] )
->set_section('-NAME-', 'John')
->add_content('text/html', 'Hello -NAME-, how are you?')
->send;
print $result->{success} ? "It worked" : "It failed: " . $result->{reason};
Any hint will be greatly appreciated.