1

I am using the preheader to read some information from the email using AMPScript and then use it in a Lookup to create a Dynamic Sender Profile. This method is what i was looking for but the preheader is not a read-only field so the user could modify it and break my lookup. Using a default email address is not a solution because the customer need the FromAddress to be always specific based on the email. So i was wondering if there is a way to prevent the email from being sent if they are using a certain email (that would be our default).

I don't know if i was clear, so here is a quick summary to explain my goal:

  1. I read a value from the preheader
  2. Use it in my Dynamic sender with a lookup
  3. The value read from the preheader does not exist in a DE
  4. The "FromAddress" is filled with a default address (example@gmail.com)
  5. The email is not sent because example@gmail.com is used
0

If I get this right, you have a DE that contains the From name that fills into a dynamic sender profile and you want to make sure that if the value is blank and the default is used, that the email does not send.

If this is the case, your best way to prevent this is to add an Exclusion Script into the emails looking to see if the value you are pulling is empty or not.

Example script:

ROWCOUNT(LOOKUPROWS("{{YourFromNameDE}}", "{{YourLookupName}}", 
@YourLookupValue)) < 1
OR
EMPTY(LOOKUP("{{YourFromNameDE}}", "{{YourLookupName}}", @YourLookupValue))

You will likely need to adjust the above or add more logic to it in order to fit your exact needs.

Another option, although not recommended - but can be easier to implement, is to include the below with a RaiseError(). The main reason this is not recommended is that in some cases:

  1. It can stop your entire send at that subscriber if using Guided send or UI send.
  2. Although it will not send, SFMC will still count it (and charge you) as a send in your available email credits.

You would insert the below into your email:

IF ROWCOUNT(LOOKUPROWS("{{YourFromNameDE}}", "{{YourLookupName}}", @YourLookupValue)) < 1 OR EMPTY(LOOKUP("{{YourFromNameDE}}", "{{YourLookupName}}", @YourLookupValue)) THEN
  RaiseError("Empty Email Name")
ENDIF 

If you want to be super safe, you can implement both, utilizing the RaiseError() as a sort of 'failsafe' if the exclusion script fails for some reason.

0

You can use RaiseError to stop an email being sent. Place this anywhere in the email

IF emailaddr = "example@gmail.com" THEN
    RaiseError("Block Send", true)
ENDIF
  • A word of caution with RaiseError() - it's recommended practice to use by exception as it can pollute error logs. The email is counted/treated as a send - so it costs you super messages – Gravitai Jan 10 '18 at 19:21
  • Just noticed too that you are using if emailaddr which would be checking is the subscriber email address matches - not the sending FromAddress – Gravitai Jan 10 '18 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.