How to troubleshoot "invalid email" errors

Troubleshooting "invalid email" errors

I see a lot of cases where a developer encounters the error “The email address for the recipient is invalid. The recipient Id follows.”, but isn’t sure what is causing the problem to occur in their code. The error can be a bit misleading, as you would expect the ID of the recipient to be the issue; however, that’s not the case with this error. I want to show you the typical reasons that this error occurs and how to check for it.

Possible causes

Email address missing for a recipient: The most straightforward reason that you may run into this problem is that the email address for one or more recipients in your API call may be missing, so you’re only passing part of the recipient information. It’s worth double-checking each recipient to make sure that all information is being sent correctly.

Incomplete email address: If you’ve checked to make sure that you are passing an email address for all of your recipients, then the issue that you may be encountering is that the email address is incomplete. For example, if you try to pass “john.doe@ example.com”, it will result in the error. At first glance, you may not notice the space between the “@” and “example.com”, but it’s an issue that I’ve seen trip developers up before.

Using a template, but not specifying all roles correctly: When you’re using a template or composite templates and encounter this error, it could be that your API call is encountering either of the above issues, or you could have an empty role that the system is trying to use, but is causing the error to occur because there’s no role name to assign a recipient to. If this is the case, you should ensure that you’re passing the correct roles with the correct recipients assigned to them and that there isn’t an empty role not being used on the template.

Additional resources

Jonathon Sammons
Author
Jonathan Sammons
Developer Support Engineer
Published