문제

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