This may be by design, I'm not sure. However I did notify the engineering team of this behavior when an existing contact is used to fire an event. Currently the DE fields are only populated when firing an event with a new contact.
When using a new contact to fire an event, you can pull DE data into your email like:
Lookup("your_de_name","de_field_to_pull_in","de_field_to_match_on",_SubscriberKey))
This can also be used for existing contacts, but the DE field will already need to be populated before the event is fired.
Update: I'm told this is functioning as designed. A workaround would be to use the API in your custom trigger or activity to update the DE before the email is sent.
Update2: Two scenarios, 1: the event is fired with a new contact. In this scenario a DE row will be created and fields will be populated with values sent in the payload:
POST https://www.exacttargetapis.com/interaction-experimental/v1/events
Payload:
{
"ContactKey":"[email]",
"EventDefinitionKey":"[key]",
"Data": {
"EmailAddress":"[email]",
"foo":123,
"FirstName":"Dan"
}
}
In this scenario, assuming there is a FirstName field on the DE, FirstName will be populated with 'Dan'. The email will be sent with 'Dan' as the FirstName value. Use the lookup() function to pull it into the email.
Scenario 2: A row with Dan's email address already exists in subscribers and the DE. In this case, FirstName in the payload will be ignored. The email is sent and whatever value was in the FirstName DE field will remain, even though a value was included in the payload.
I always use the AttributeValue() function when dealing with personalization strings. It'll return an empty string if it doesn't exist:
Data Extension
SubscriberID | EmailAddress
-------------+------------------------
238535 | aspriggs@degdigital.com
Code
%%[
VAR @account_id
SET @account_id = AttributeValue("subscriberid")
set @emailAddress = iif(not empty(@account_id),lookup("AMPScriptTest","EmailAddress","SubscriberID",@account_id),"not found")
]%%
<br>@account_id: %%=v(@account_id)=%%
<br>Your emailAddress is: %%=v(@emailAddress)=%%
Output (via Email Send Preview)
@account_id: 238535
Your emailAddress is: aspriggs@degdigital.com
Best Answer
As an assumption that this resolved his issue, I am transferring this from a comment to an answer for easy reference:
If you are using 'email attribute from Contacts' then
%%emailaddr%%
should pull that email. This personalization string pulls the assigned sendable Email Address, which in that case would be the email address stored in All Subscribers or 'the main email address'.If you want an email address that is not the sendable one, then you would need to use the field name that is stored in the sendable data (e.g.
%%secondary_email%%
if stored in field name secondary_email) OR do a lookup to the DE to gather that email. E.g.Lookup('myDE', 'EmailAddress','SubscriberKey',_SubscriberKey)
.