Mandrill “reject_reason”: “invalid-sender”

前端 未结 6 2104
-上瘾入骨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 11:46

    For me, it was because my emails were coming from email@example.net1 Mandrill rejected me because of the 1 at the end. e+mail@example.net and email@example.neta are both valid and will be accepted.

    My other tests just had blank From headers, so they were rejected as well. I didn't even realize these emails were being received by Mandrill until I logged in and checked the API logs.

    0 讨论(0)
  • 2020-12-20 11:55

    If you use .NET SmtpClient, may be this is because of bug on it: https://social.msdn.microsoft.com/Forums/vstudio/en-US/4d1c1752-70ba-420a-9510-8fb4aa6da046/subject-encoding-on-smtpclientmailmessage

    Workaround, that helped us:

    use

    message.SubjectEncoding = Encoding.Unicode;
    

    instead of

    message.SubjectEncoding = Encoding.UTF8;
    

    This is still actual in .Net Framework 4.7.2

    0 讨论(0)
  • 2020-12-20 11:56

    It'd be useful to see the call/email that's being sent. That error means that there's an invalid sender, as indicated in the reject reason field. That could be because of an invalid email address, invalidly-encoded from name, or invalid or broken encoding in other headers making it so that Mandrill can't parse the "from" header, but without seeing the actual email that you're sending, it's hard to say for sure exactly what the issue is.

    You probably want to check that there's a fully-qualified domain name in the from email address, and that if the subject line is encoded, there aren't things like newline (\n) characters that break multibyte characters in the subject line. If you aren't able to identify the issue in the raw SMTP message, feel free to get in touch with support for further troubleshooting assistance.

    0 讨论(0)
  • 2020-12-20 12:05

    I had the same problem, in my case, I had forgotten to complete the template defaults "From Name" and "Subject".

    0 讨论(0)
  • 2020-12-20 12:05

    I had the same problem. In my case encoding in headers was the problem. I did change the headers encoding to UTF-8 and it worked. I was using C# SMTP and the code is below.

    message.HeadersEncoding = Encoding.UTF8;
    

    Hope it works!

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题