0

I'm working on a product for Japanese clients and am getting an error when trying to send to email addresses like ああ@ああ.blah.jp AWS SES (simple email service) rejects the email address: Aws::SES::Errors::InvalidParameterValue (Local address contains control or whitespace)

The SES docs say that you need to use RFC 2047 encoding which I am. ActionMailer encodes these addresses automatically so what gets sent to SES looks like:

=?UTF-8?Q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E6=83=85=E5=A0=B1=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E6=83=85=E5=A0=B1=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E6=83=85=E5=A0=B1=E3=83=A6=E3=83=BCsfd=E3=82=B6=E3=83=BC=E6=83=85=E5=A0=B1@sdfds.com?=

I don't understand why I'm getting the error.

jeznag
  • 4,183
  • 7
  • 35
  • 53
  • You may have to [punycode](https://en.wikipedia.org/wiki/Punycode) that domain. – tadman Jul 03 '17 at 00:34
  • The RFC 2047 spec says that you should be able to use UTF characters. Refer to https://github.com/mikel/mail/blob/21222e1b48f08f6f848d26643d6b6fb1d873d18c/spec/mail/encodings_spec.rb#L733 – jeznag Jul 03 '17 at 00:40
  • 1
    _"ActionMailer doesn't seem to encode these addresses"_ – did you check that assumption? – Stefan Jul 03 '17 at 07:13
  • Oops checked the logs and you're right it is being encoded. Don't understand why SES is rejecting it. – jeznag Jul 03 '17 at 07:52
  • @jeznag That's typically in the email address component, not the domain component. – tadman Jul 03 '17 at 23:38

2 Answers2

0

Looks like it's not supported by SES yet. Documentation is confusing on this topic.

Duplicate of this question.

jeznag
  • 4,183
  • 7
  • 35
  • 53
0

I realised that user email contained whitespace the the end. So I removed the whitespace and it starts working

itsnikolay
  • 17,415
  • 4
  • 65
  • 64