Amazon-ses-first brother ask how to use Amazon ses in a PHP environment

Source: Internet
Author: User
Tags ssl certificate

Hello, my site needs to send activation email, currently using SMTP, many of them into the dustbin, I registered Amazon SES, but do not how to use, I would like to ask under the PHP environment How to use Amazon SES, I see Segmentfault This site is also used by this service


Add two more questions, how to set the sender's name, as in the above imageSegmentFault问答社区

There is how to send HTML mail, I do not set the following:

$m->setmessagefromstring (', ' I am brother this is the message body.
');

The message received is only: I'm brother. The is the message body. The back of the content is not

Reply content:

Hello, my site needs to send activation email, currently using SMTP, many of them into the dustbin, I registered Amazon SES, but do not how to use, I would like to ask under the PHP environment How to use Amazon SES, I see Segmentfault This site is also used by this service


Add two more questions, how to set the sender's name, as in the above imageSegmentFault问答社区

There is how to send HTML mail, I do not set the following:

$m->setmessagefromstring (', ' I am brother this is the message body.
');

The message received is only: I'm brother. The is the message body. The back of the content is not

To use the SES service first you have to make sure that the service is open, assuming you have already applied for SES, and have obtained access key and Secret key

Then you need to download a library file First Http://aws.amazon.com/code/Amazon-SES ..., first use needs to verify whether you are the owner of the Outbox, you need to execute the following code

Require_once ' ses.php '; $ses = new Simpleemailservice (' Access key here ', ' Secret key here ');//fill in the email address you need as a Outbox, this address must exist, Because it will send an email past verify Print_r ($ses->verifyemailaddress (' user@example.com '));

If successful, it will return something like the following

Array (  [RequestID] = 1b086469-291d-11e0-85af-df1284f62f28)

At this time, log in to the mailbox you just filled out, you will receive a verification email, click on the verification link in the email to complete the verification step.

But note that at this time you can only send mail to yourself, not any other third-party mailbox to send, because you are only a developer status, if you need to send mail to other users, you need to "request Production access" to Amazon.

Click on this link to submit the application, you may need to fill in the daily quota sent, you can apply according to their own needs, anyway, can be adjusted later.

It is important to note that your quota is not in place, that is, if you send a limit of 10,000 messages per day, then you can only send 100 on the first day, then send 500 the next day, and so on, you will be able to send 10,000 emails in about a week. This is also to prevent spammers from abusing the service. The application is manually audited, so it will take a while, but not for a few hours.

When this is all done, you will be able to use SES normally, here is an example of PHP code, very simple http://www.orderingdisorder.com/aws/s ...

Update

To send a Chinese question, just set the following code

$m = new Simpleemailservicemessage (); $m->addto (' recipient@example.com '); $m->setfrom (' user@example.com '); $m- >setsubject (' I am Chinese title '), $m->setmessagefromstring (' I am Chinese content. '); /again here set the title and content encoding $m->setsubjectcharset (' UTF-8 '); $m->setmessagecharset (' UTF-8 ');p rint_r ($ses->sendemail ($m ));
Update

If you need to send HTML content, you need to use setMessageFromString the second parameter, which is specifically used to send HTML content, such as

The first argument can be left blank $m->setmessagefromstring (NULL, '

This is a test of HTML

It's just a test.

');

If you want to set the sender's name, you can set it in the same setFrom '发件人名称 <邮箱地址> ' format as

$m->setfrom (' Joyqi 
 
  
   
  ');
 
  

But if you want to change the above Joyqi into Chinese, it will appear garbled, this time you need to base64_encode manually code, and specify the encoding format, such as

coded function Address_encode ($str) {    return ' =? UTF-8? B? '. Base64_encode ($STR). '?=';} $m->setfrom (address_encode (' Test Chinese sender '). ' 
 
  
   
  ');
 
  

OK, thank you, download a library file, this library page cannot open, is not ses.php? If yes I go to other places to download the example you last mentioned connected inside there are

Very simple, very useful!

notice:undefined property:simpleemailservicerequest:: $resource in C:\xampp\htdocs\husili\email\ses.php on line 491

Warning:simpleemailservice::sendemail (): SSL certificate problem, verify that the CA cert is OK. Details:error:14090086:ssl routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in C:\xampp\htdocs\husili \email\ses.php on line 357

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.