1

I am pulling in First Name from subscriber information but it has been encrypted before the data is pushed up to ExactTarget, I need to use AMPscript to decrypt and check the data to make sure it is valid and there. The code validates fine on its own the problem seems to come from how much code we place there, the email will not send with the AMPscript there.

I was given the following recommendations by support as to why the email did not send and also how to resolve:

Thank you for contacting us with your question. I have been re-assigned your case and have been researching this further for you.

The issue does appear to be within the AMPScript. I sent myself the email as a guided send and it would not send to me. There were no errors but the job would never complete. I updated my profile attributes so that I would have a first name, and I received an error that there were to many characters in the subject line.

The issue is within the AMPScript, and unfortunately being able to fix or write this for you to where it works is beyond what Standard Support is able to provide as this is considered custom code.

There are a couple recommendations I can make at this point:

  1. Update the First Name attribute. You can update the attribute to have a default value such as "Valued Customer", so that if they do not have a First Name filled out, then it will put the default value instead.

  2. Inquire at code.exacttarget.com. This is a web-portal that is maintained by our developers and has a very active community. If you post what you are trying to do, then you may be able to get assistance with your custom AMPScript code from one of our developers or another developer from a different organization that has experience with this type of issue.

One of the solutions was to post here, I am hoping somebody ha some insight as to another way to decrypt and pull in and decrypt the First Name. I have included the code I am using below, any help would be appreciated.

Thanks!

%%[
    var @f_name, @firstname
IF Empty(first_name) == true then
   InsertDE("ent.ErrorLog","EmailAddress",emailaddr, "EmailName",emailname_, "ErrorMessage","First Name is Empty", "CreatedDate",NOW(), "EmailSendID",jobid)
   RaiseError("first name is blank. Decrypt is going to blow! Skipping.", true)
ENDIF 

set @f_name=DecryptSymmetric(first_name, "des;mode=cbc", @null, "A4DF6AF2", @null, @null, @null, @null)

IF Empty(@f_name) == true then
    InsertDE("ent.ErrorLog","EmailAddress",emailaddr, "EmailName",emailname_, "ErrorMessage","First Name Data did not decrypt", "CreatedDate",NOW(), "EmailSendID",jobid)
    RaiseError("first name data did not decrypt", true)
ENDIF 

set @firstname = ProperCase(@f_name)

]%%

%%=v(@firstname)=%%, welcome to a healthier you!
2
  • You're missing an "@" on the first_name variable in the first "if" statement. And also in your DecryptSymmetric() function. Commented Dec 10, 2014 at 14:50
  • How are you encrypting your data? Commented Dec 12, 2014 at 23:12

1 Answer 1

0

I would start with a simple use-case to make sure the decryption is the true issue. Something like this perhaps:

%%[

var @first_name_enc, @first_name_plain, @first_name_dec, @null
set @first_name_plain = "John"
/* or if the first name is a personalization string in the sending audience */
/* set @first_name_plain = [first_name] */
set @password = "A4DF6AF2"
set @first_name_enc = EncryptSymmetric(@first_name_plain, "des;mode=cbc", @null, @password, @null, @null, @null, @null)

]%%
<br>@first_name_plain: %%=v(@first_name_plain)=%%
<br>@first_name_enc: %%=v(@first_name_enc)=%%
%%[

set @first_name_dec = DecryptSymmetric(@first_name_enc, "des;mode=cbc", @null, @password, @null, @null, @null, @null)

]%%
<br>@first_name_dec: %%=v(@first_name_dec)=%%

Results:

@first_name_plain: John 
@first_name_enc: Du5zgS1AF3w= 
@first_name_dec: John 

You can un-comment the second @first_name_plain declaration if the first name is a personalization string and not a variable set somewhere else in the AMPScript block.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .