Mandrill “reject_reason”: “invalid-sender”

前端 未结 6 2146
-上瘾入骨i
-上瘾入骨i 2020-12-20 11:37

I\'m trying to send emails using mandrill email service but I get the following error

    Full Response
[
    {
        \"email\": \"someemail@somedomain.co         


        
6条回答
  •  孤城傲影
    2020-12-20 12:13

    I've had a similar problem recently. It was due to my use of certain characters in the message.from_name field. After searching through documentation and stack overflow, I couldn't find a list of forbidden characters, so although this doesn't necessarily pertain to your case, I thought I'd share this small list I compiled of some acceptable characters (not an exhaustive list):

    • a-z
    • A-Z
    • 0-9
    • _, -, !, #, $, %, \, ^, &, *, +, =, {, }, ?, .

    In JS, here's a RegExp that will match with forbidden characters (or, rather, any characters that aren't in the aforementioned list):

    const pattern = /[^a-zA-Z0-9_\-!#$%\^&*+={}?.]/;

    Hope this is helpful for anyone else stuck on this.

提交回复
热议问题