Adding "web version link" in email by sendgrid - email

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('View this email in your browser<br />'.$sg_html_code);
...

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.

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

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

Related

Mail stay in queue when i use Sendgrid in symfony6

I have set my Sendgrid single sender and validate it ( status = verified).
I use SMTP, create my key that i paste in my code (.env file of my app):
MAILER_DSN=sendgrid+smtp://#default
Then i try to test integration in Sendgrid by clicking on button and refresh my localhost/ page (of course the controller's route is "/" and it contains the code using mailer to send a mail as explain in mailer documentation).
On my vue i don't have error code but mail stay in queue status...
Here the screenshot taken of the profiler:
Can someone tell me why my mail stay queued?
Of course the From email address is mine ( the verified one) and the To is anotherone of mine.
Maybe i have to configure something in my outlook mail (the From one) ?
Sendgrid never match the verification, it stay in checking status until message :
Hmm, we haven't seen your email yet.
Please check your code, run it again, then click "Retry".
Thanks for reply,
Regards,
In your question you said that your MAILER_DSN environment variable is set to:
MAILER_DSN=sendgrid+smtp://#default
That is missing your API Key though. You need to create an API key in the SendGrid dashboard and then add the API key to the MAILER_DSN variable, between the // and the #default like this:
MAILER_DSN=sendgrid+smtp://API_KEY#default
One other thing, ensure that you have installed the SendGrid transport with this command:
composer require symfony/sendgrid-mailer
Yes, thanks you a lot for reply.
Of course all was set as you notify me.
I now have fix my issue, in fact the problem for me with the mail that remains in queued is that the messenger was installed so in asynchronous by default.
I had to add the option message_bus: false in my config/packages/mailer.yaml file not to have the asynchronous option used.
Hopefully this is useful for some people.
add the option message_bus: false in my config/packages/mailer.yaml:
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
message_bus: false

Magento and mandrill smtp headers

I am using Mandrill as a SMTP.
It is successfully connected to Magento 2.
My question :
Is it possible to use Mandrill's custom header references through Magento Email Templates.
For example, I have created custom templates in Mandrill that can be called upon by a customized field in the email header.
Usually it can be added the same way as the reply-to field.
I want to use the following functionality below:
https://mandrill.zendesk.com/hc/en-us/articles/205582117-How-to-Use-SMTP-Headers-to-Customize-Your-M...
Can I add in the header template :
<?php
$headers = $this->getHeaders();
$headers->addTextHeader('X-MC-Template', 'template_name');
?>
Any guidance would be greatly appreciated.
Thanks
You can create your own plugin for Magento (as it was done in the mageplaza/magento-2-smtp extension, they have shared their experience here) that will help you to rewrite the send mail function sendMessage () through the aroundSendMessage () function. In this case you can write headers on your own depend on the message.
How to create a plugin for Magento 2 you can find at Magento official documentation: https://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html

Custom tags in Jira email handler

Is there a way to make a Jire email handler ignore the From field in an email and go for a custom tag instead? I know I could work with the API instead but that's in the pipe. this is a temporary solution that will be used until a more robust system is built.
To clarify what we have today:
Email is sent to inbox, (hr#company.com)
Jira picks is up and creates an issue.
Jira looks at the From field and creates a uses if none exist.
What we're trying to achieve:
Form is filled out, and an area is chosen (hr, facilities etc.).
Form is posted to an API that creates an email (basically a no-reply adress over SMTP) and sends it to the appropriate inbox (for example hr#company.com).
Email lands in the inbox and Jira looks in it and creates an issue in project or label 'HR'.
Jira now looks in the email and finds custom tags named [user] and [user-email] (or something) and creates a user from the tag.
Example email
From: no-reply#company.com
To: hr#company.com
Subject: Some problem
Body: Explanation of problem
Have a good day!
/Mike
[user:"Michael Smith"]
[userEmail:"michael.smith#company.com"]
If we were to implement this system now, we would loose the possibility to create new users because all emails would come from the same "no-reply" adress.
I have searched in the Atlassian forums and such, but with no luck. Have not found anything in the official documentation, but I fear that I might be looking in the wrong place.
I hope that I'm being clear, and that someone has any idea if it is possible.
Thank you!
You need to write your own plugin and create your own Mailhandler.
For example you can use a regex which looks for the tag
[userEmail:"michael.smith#company.com"] and retrieve the emailadress from the string. Do the same for the [user]-tag, if the user doesn't exist.
Here is a tutorial that shows how to create and setup custom Message Handlers:
https://developer.atlassian.com/jiradev/jira-platform/guides/email/tutorial-custom-message-mail-handler-for-jira#Tutorial-Custommessage(mail)handlerforJIRA-Step7:Implementarealmessagehandlerback-end
The rest should be easy from here.

How to delete a Audience Manager Contact in code within Tridion 2011?

I'm using Tridion.OutboundEmail.ContentDelivery.Profile.Contact and I can't find any method of deleting a Contact.
There is no such option in the Content Delivery API.
You can only delete Contacts on the Content Manager side.
Use Tridion.AudienceManagement.API.Contact.Delete() to delete your Contacts.
What version of Tridion you are using?
In 2011 SP1, there is new API namespace for Contact. AFAIK, It is possible in 2011 on wards but not on 2009 (read-only API ?).
Namespace: Tridion.AudienceManagement.API. Below is the sample from API Docs
TcmUri uri = new TcmUri(3, 456, TcmItemTypes.Contact);
Contact contact = new Contact(uri);
contact.Delete();
Removing users may only be possible on the Content Manager API. Or at least the API docs for the Content Manager mention a Contact.Delete method, while that isn't mentioned in the API docs for the Content Delivery API.

Expression Engine using the Champagne Extension troubleshooting

I have an issue in Expression Engine using the Champagne Extension where it won't allow me to send out campaigns. This extension utilizes https://www.campaignmonitor.com/ api to send out mass emails.
The Error I get is "HTML Content URL Required" when I try to send out campaigns form the back end of the Expression Engine Install.
What could be causing this issue that relates to the expression engine install?
This error is received anytime the URL to your html or text content is not visible. More often this is seen when someone forget to include the text version. A good way to test is to click the preview HTML/TEXT button and make sure both give you the correct results.
They cannot be blank.
For an alternative solution, be sure to checkout my add-on Postmaster. It allows clients to publish email campaigns just by creating a new entry. You can setup any number of configuration, so you can even send draft email to a test subscriber list. And since everything is within channel entries, you can use whatever fieldtypes you like, and it works with MailChimp as well as CampaignMonitor.
https://objectivehtml.com/articles/postmaster-the-definitive-email-solution-for-expressionengine