0

My use case is: I have an email, which contains a button. When a customer clicks on a button in the email, an internal user should receive a notification of his data (Name, Email).

I tried it with the Triggered Send, however, when I clicked on the button I'm only receiving the notification. This notification should go to the internal user email.

This should happen in real-time.

%%[ Set @SubscriberKey = RequestParameter("SubscriberKey") Set @FirstName = RequestParameter("FirstName") Set @LastName = RequestParameter("LastName") SET @EmailAddress = "[email protected]" SET @TriggerSendExternalKey = "xxx_Notification" /* Specify the external key of the TriggerSend */ SET @TriggerSend = CreateObject("TriggeredSend") SET @TriggerSendDefinition = CreateObject("TriggeredSendDefinition") SetObjectProperty(@TriggerSendDefinition, "CustomerKey", @TriggerSendExternalKey) SetObjectProperty(@TriggerSend, "TriggeredSendDefinition", @TriggerSendDefinition) /* Specify the email address and the subscriber key */ SET @TriggerSendSubscriber = CreateObject("Subscriber") SetObjectProperty(@TriggerSendSubscriber, "EmailAddress", @EmailAddress) SetObjectProperty(@TriggerSendSubscriber, "SubscriberKey", @SubscriberKey) /* Fill out the FirstName field in the TriggerSend data extension */ SET @TriggerSendFirstName = CreateObject("Attribute") SetObjectProperty(@TriggerSendFirstName, "Name", "FirstName") SetObjectProperty(@TriggerSendFirstName,"Value", @FirstName) AddObjectArrayItem(@TriggerSend, "Attributes", @TriggerSendFirstName) AddObjectArrayItem(@TriggerSend, "Subscribers", @TriggerSendSubscriber) SET @TriggerSend_statusCode = InvokeCreate(@TriggerSend, @TriggerSend_statusMsg, @errorCode) IF @TriggerSend_statusCode != "OK" THEN OUTPUTLINE(CONCAT("Status: ",@TriggerSend_statusMsg," / Code: ",@errorCode)) ENDIF ]%% <script> url = "https://company.xxx.com/contact/"; // Simulate an HTTP redirect: setTimeout(function() { // timer window.location.replace(url); }, 2000); // 2000 ms = 2 seconds </script> 

1 Answer 1

3

You cannot trigger an email from within another email.

I’d suggest pointing the button to a CloudPage first. On the CloudPage include the script to trigger the notification email and at the end include a Redirect function to take the subscriber to the desired website:

Redirect(“https://company.xxx.com/contact/“) 

The whole thing might take a split second longer to load, but the subscriber won’t notice anything.

If you want to pass any data from the email to the CloudPage to include it in the triggered send, make sure to pass it in the CloudPagesURL function when creating the button in the email.

This example includes the string value as part of a name and value pair.

%%=CloudPagesURL(ID, 'CampaignCode', @CampCode)=%% 
1
  • @salesforce-user - if this answer helped you, please remember to accept it by clicking the checkmark - thanks! Commented Aug 10, 2021 at 13:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.