質問

I'm using aws-sdk-for-php and using AmazonSES for sending email. The problem is I want to set the name for the email. Example:

指定 < email_address >

Here my source code:

$mailer = new \AmazonSES( $aws_config ); $response = $mailer->send_email($mail_data['from'],$mail_data['to']);
役に立ちましたか?

解決

I believe the format you're looking for is as follows:

"John Doe" <johndoe@example.com>

Reference: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/email-format.html

他のヒント

I have resolved the same issue after checking this aws forum link . I was using aws SES for sending mails using java sdk , so I have added the from email id in the application.yml file like below.

from: John Doe <johndoe@example.com>

SES doesn't support Japanese characters by default, so you have to encode from name with iso-2022-jp encoding.

below is sample in python.

from email.header import Header
import os

FROM_ADDRESS = os.environ.get('FROM_ADDRESS')
FROM_NAME = os.environ.get('FROM_NAME')

...
from_address = '{} <{}>'.format(Header(FROM_NAME.encode('iso-2022-jp'),'iso-2022-jp').encode(), FROM_ADDRESS)

I only changed the format and it is working fine for me.

"from": {
   "name": "name",
   "address": "email address"
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top