문제

How do I add a link to a web version of my sendgrid emails like "having trouble reading this email, click here"?

[EDIT] I use a php sendgrid library include "sendgrid-php-master/SendGrid_loader.php";

And I use this code and it doesn't work :

$mail = new SendGrid\Mail();
....
$mail->setHtml('<a href="[weblink]">View this email in your browser</a><br />'.$sg_html_code);
...
도움이 되었습니까?

해결책 2

Please be aware that SendGrid terminated the [weblink] and [unsubsribe] in 2017 (30/09/2017). You need to migrate with the new migrating toolkit.

Read more from SendGrid here

다른 팁

Just to confirm what Lirianna said, here you have the answer from Sendgrid support team to the same question:

Using [Weblink] will only be supported when using our Marketing Campaigns tool. To use this in a transactional template, you would need to create and host that link yourself.

It's the latter half of 2021 and I tried using {{Weblink}} (capitalisation important) and it works just fine for me using the Dynamic Templates option.. YMMV

As per the official SendGrid documentation {{Weblink}} is available. Refer: SendGrid docmentation link

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top