使用Amazon SES发送邮件并使用Laravel 5.4显示邮件统计信息

我想设置SES以使用Laravel 5.4批量发送邮件,我希望看到它的状态如软反弹, 硬弹跳,点击,打开等信息,并在我的管理面板中显示此信息。</ p>

我读了一些亚马逊的文档并且没有标记,所以任何人都可以帮助我变得更好 满足上述需求的教程</ p>

提前多多谢谢你!</ p>
</ div>

展开原文

原文

I want to setup SES for sending mails in bulk using Laravel 5.4 and I want to see it's stats like soft bounce, hard bounce, clicks, opens, etc information and display this information in my admin panel.

I read some docs of amazon and it's not up to mark so can anyone please help me to get nice tutorial which fulfils my needs above mentioned

Thank you so much in advance!

1个回答



您可以尝试使用Aws API来获取正在发送的电子邮件的状态。
如果您想获得退回和投诉,可以创建 您可以通过创建主题在AWS面板中添加API,还必须验证这些API,否则AWS仪表板中会描述其他方法。</ p>

https://aws.amazon.com/blogs/messaging-and-targeting / handling-bounces -s-complaint / </ p>
</ div>

展开原文

原文

You can try out Aws API to get status of your email being send. And if you want to get bounce and complaints you can create a API from your side and add those in AWS panel by creating topics and also you have to verify these, or else there are other methods described in AWS Dashboard.

https://aws.amazon.com/blogs/messaging-and-targeting/handling-bounces-and-complaints/

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
cPanel使用Laravel 5.4在生产中发送电子邮件

<div class="post-text" itemprop="text"> <p>I have a Laravel project on Godaddy web hosting </p> <p>I want to send an email on submitting some data</p> <p>So I tested on my local machine with my Gmail account "sent from me to me" and it worked fine, but when I moved the same exact configuration errors just started popping out of nowhere </p> <p>I got an error related to some socket and I found an answer for that one.</p> <p>I tried using the email created in cPanel, didn't work.</p> <p>I tried to set the Gmail account that was working fine, also not working.</p> <p>The Gmail account kept giving me this error</p> <pre><code>local.ERROR: Connection could not be established with host smtp.gmail.com [Connection refused #111] {"exception":"[object] (Swift_TransportException(code: 0): Connection could not be established with host smtp.gmail.com [Connection refused #111] at /home/cr4jtnq8a04f/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:269) [stacktrace] </code></pre> <p>When I changed to the cpanel email settings, I found no error neither the email that was supposed to be sent.</p> <p>Here is my .env settings for the cPanel email settings</p> <pre><code>MAIL_DRIVER=smtp MAIL_HOST=mail.glistars.com MAIL_PORT=25 MAIL_USERNAME=info@glistars.com MAIL_PASSWORD=MyPassword MAIL_ENCRYPTION=tls </code></pre> <p>Here is my config/mail.php file</p> <pre><code>&lt;?php return [ /* |-------------------------------------------------------------------------- | Mail Driver |-------------------------------------------------------------------------- | | Laravel supports both SMTP and PHP's "mail" function as drivers for the | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", | "sparkpost", "log", "array" | */ 'driver' =&gt; env('MAIL_DRIVER', 'smtp'), /* |-------------------------------------------------------------------------- | SMTP Host Address |-------------------------------------------------------------------------- | | Here you may provide the host address of the SMTP server used by your | applications. A default option is provided that is compatible with | the Mailgun mail service which will provide reliable deliveries. | */ 'host' =&gt; env('MAIL_HOST', 'smtp.mailgun.org'), /* |-------------------------------------------------------------------------- | SMTP Host Port |-------------------------------------------------------------------------- | | This is the SMTP port used by your application to deliver e-mails to | users of the application. Like the host we have set this value to | stay compatible with the Mailgun e-mail application by default. | */ 'port' =&gt; env('MAIL_PORT', 587), /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all e-mails sent by your application to be sent from | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | */ 'from' =&gt; [ 'address' =&gt; env('MAIL_FROM_ADDRESS', 'info@glistars.com'), 'name' =&gt; env('MAIL_FROM_NAME', 'Glitter Stars'), ], /* |-------------------------------------------------------------------------- | E-Mail Encryption Protocol |-------------------------------------------------------------------------- | | Here you may specify the encryption protocol that should be used when | the application send e-mail messages. A sensible default using the | transport layer security protocol should provide great security. | */ 'encryption' =&gt; env('MAIL_ENCRYPTION', 'tls'), /* |-------------------------------------------------------------------------- | SMTP Server Username |-------------------------------------------------------------------------- | | If your SMTP server requires a username for authentication, you should | set it here. This will get used to authenticate with your server on | connection. You may also set the "password" value below this one. | */ 'username' =&gt; env('MAIL_USERNAME'), 'password' =&gt; env('MAIL_PASSWORD'), /* |-------------------------------------------------------------------------- | Sendmail System Path |-------------------------------------------------------------------------- | | When using the "sendmail" driver to send e-mails, we will need to know | the path to where Sendmail lives on this server. A default path has | been provided here, which will work well on most of your systems. | */ 'sendmail' =&gt; '/usr/sbin/sendmail -bs', /* |-------------------------------------------------------------------------- | Markdown Mail Settings |-------------------------------------------------------------------------- | | If you are using Markdown based email rendering, you may configure your | theme and component paths here, allowing you to customize the design | of the emails. Or, you may simply stick with the Laravel defaults! | */ 'markdown' =&gt; [ 'theme' =&gt; 'default', 'paths' =&gt; [ resource_path('views/vendor/mail'), ], ], 'stream' =&gt; [ 'ssl' =&gt; [ 'allow_self_signed' =&gt; true, 'verify_peer' =&gt; false, 'verify_peer_name' =&gt; false, ], ], ]; </code></pre> <p>Here is my controller function</p> <pre><code>public function send() { $data = [ 'name' =&gt; request('name'), 'phone' =&gt; request('phone'), 'message' =&gt; request('message'), 'lang' =&gt; request('lang'), ]; Mail::to('abdul.elah.js@gmail.com')-&gt;send(new Enquiry($data)); return response()-&gt;json([ 'message' =&gt; 'Email Sent Successfully' ]); } </code></pre> <p>I am getting the response back but the email is not sent.</p> </div>

使用Amazon SES发送电子邮件时出错

<div class="post-text" itemprop="text"> <p>My Email sending script was working fine for the last few years.</p> <p>Few days back I saw following error message when I ran email sending script:</p> <p><a href="https://i.stack.imgur.com/PD6Fu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PD6Fu.png" alt="enter image description here"></a></p> <p>I am not getting why this is happening when I send email using Amazon SES, earlier it never happened.</p> <p>Here is email sending script code :</p> <pre><code> &lt;?php ob_start(); ini_set('memory_limit', '512M'); ECHO $document_root = $_SERVER['DOCUMENT_ROOT'];; require_once($document_root."wp-load.php"); function testnewcronsendmail() { $mail = new PHPMailer; $mail-&gt;From = 'info@itsxxx.com'; // A Verified email. $mail-&gt;FromName = 'MYSON'; //$mail-&gt;addAddress('ravikathait01@gmail.com'); $mail-&gt;addAddress('shishupal.shakya@itsxxx.com'); $mail-&gt;isHTML(true); $mail-&gt;Subject = 'test' ; $mail-&gt;Body = 'test'; var_dump($mail-&gt;ErrorInfo); var_dump($mail-&gt;send()); } testnewcronsendmail(); ?&gt; </code></pre> <p>I did some learning and found that it is server related issue but I am not getting which thing should I correct at the server.</p> <p>Anyone who faced such issue earlier, Pls suggest me the solution.</p> </div>

如何在PHP类中使用Amazon SES

<div class="post-text" itemprop="text"> <p>I installed the AWS PHP SDK using composer but am unsure how to use AWS SES within my existing class.</p> <p>I used the sample code in the SES PHP Docs website. I was able to create a test.php file to test out that code and it works. However when trying to use SES within my class I get error 500 within my page.</p> <p>Ive tried including the autoload file in the Class file.</p> <pre><code>&lt;?php namespace Main\messaging; use vendor\Aws\Ses\SesClient; use vendor\Aws\Exception\AwsException; class Email { public function sendEmail(){ // Create an SesClient. Change the value of the region parameter if you're // using an AWS Region other than US West (Oregon). Change the value of the // profile parameter if you want to use a profile in your credentials file // other than the default. $SesClient = new SesClient([ 'profile' =&gt; 'default', 'version' =&gt; '2010-12-01', 'region' =&gt; 'us-west-2' ]); // Replace sender@example.com with your "From" address. // This address must be verified with Amazon SES. $sender_email = 'welcome@myemail.com'; // Replace these sample addresses with the addresses of your recipients. If // your account is still in the sandbox, these addresses must be verified. $recipient_emails = ['test@email.com']; // Specify a configuration set. If you do not want to use a configuration // set, comment the following variable, and the // 'ConfigurationSetName' =&gt; $configuration_set argument below. //$configuration_set = 'ConfigSet'; $subject = 'Amazon SES test (AWS SDK for PHP)'; $plaintext_body = 'This email was sent with Amazon SES using the AWS SDK for PHP.' ; $html_body = '&lt;h1&gt;AWS Amazon Simple Email Service Test Email&lt;/h1&gt;'. '&lt;p&gt;This email was sent with &lt;a href="https://aws.amazon.com/ses/"&gt;'. 'Amazon SES&lt;/a&gt; using the &lt;a href="https://aws.amazon.com/sdk-for-php/"&gt;'. 'AWS SDK for PHP&lt;/a&gt;.&lt;/p&gt;'; $char_set = 'UTF-8'; try { $result = $SesClient-&gt;sendEmail([ 'Destination' =&gt; [ 'ToAddresses' =&gt; $recipient_emails, ], 'ReplyToAddresses' =&gt; [$sender_email], 'Source' =&gt; $sender_email, 'Message' =&gt; [ 'Body' =&gt; [ 'Html' =&gt; [ 'Charset' =&gt; $char_set, 'Data' =&gt; $html_body, ], 'Text' =&gt; [ 'Charset' =&gt; $char_set, 'Data' =&gt; $plaintext_body, ], ], 'Subject' =&gt; [ 'Charset' =&gt; $char_set, 'Data' =&gt; $subject, ], ], // If you aren't using a configuration set, comment or delete the // following line //'ConfigurationSetName' =&gt; $configuration_set, ]); $messageId = $result['MessageId']; echo("Email sent! Message ID: $messageId"." "); } catch (AwsException $e) { // output error message if fails echo $e-&gt;getMessage(); echo("The email was not sent. Error message: ".$e-&gt;getAwsErrorMessage()." "); echo " "; } } } </code></pre> <p>What I expected was to see the the confirmation message echo out and receive the email. However this is not what I get. I dont think I am properly including the AWS library into my class.</p> </div>

使用AWS SES和PHP发送电子邮件

<div class="post-text" itemprop="text"> <p>I saw a few posts regarding this topic but none were relevant so I had to ask.<br><br> Here's a quick test on my EC2 lamp stack, it seems to fail silently. I am getting <code>echo '0'</code> from my trace output<br><br> <strong>Question</strong>: How can I send email using SES?<br><br> Both <code>john@aol.com</code> and <code>frank@gmail.com</code> have been verified.<br> Also, the domain I'm sending from has been verified</p> <pre><code>function sendMail($to, $subject, $message, $from ) { require_once('sdk-1.5.6.2/sdk.class.php'); $AWS_KEY = "eZNhiEcda8BXint6vfF2"; $AWS_SECRET_KEY = "KUnNKiZNG7ng2Ync2vZNhvfkdzVS0v4NCUE5drw5"; $curl = curl_init(); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_FTP_SSL, CURLFTPSSL_TRY); $submit_url = "http://myDomain.com"; curl_setopt($curl, CURLOPT_URL, $submit_url); curl_exec($curl); curl_close($curl); $amazonSes = new AmazonSES(array( "key" =&gt; $AWS_KEY, "secret" =&gt; $AWS_SECRET_KEY )); //$from = 'sender@myDomain.com'; //$amazonSes-&gt;verify_email_address($from); $response = $amazonSes-&gt;send_email( $from, array( "ToAddresses" =&gt; $to ), array( "Subject.Data" =&gt; $subject, "Body.Text.Data" =&gt; $message ) ); //var_dump( $response); if (!$response-&gt;isOK()) { echo '0';//&lt;&lt;&lt;&lt; this outputs }else { echo '1'; } //echo '2'; } sendMail('john@aol.com', "my subj", "my msg", "frank@gmail.com" ); </code></pre> <p><br><br> on XAMPP I get these errors</p> <pre><code>Fatal error: Uncaught exception 'cURL_Exception' with message 'in sdk-1.5.6.2\lib equestcore equestcore.class.php on line 824 cURL_Exception: cURL resource: Resource id #14; cURL error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes. in sdk-1.5.6.2\lib equestcore equestcore.class.php on line 824 </code></pre> <p>NOTE: cURL support enabled on <strong>EC2</strong> and <strong>XAMPP</strong><br><br> heres the var_dump (all strings have been randomized)</p> <pre><code> object(CFResponse)#1 (3) { ["header"]=&gt; array(9) { ["x-amzn-requestid"]=&gt; string(36) "BhDwFTvj9-7MkK7Rp2mnx-ij10DESTi-g6Lb" ["content-type"]=&gt; string(8) "text/xml" ["content-length"]=&gt; string(3) "280" ["date"]=&gt; string(29) "Sat, 02 Jun 2012 12:18:12 GMT" ["_info"]=&gt; array(23) { ["url"]=&gt; string(38) "https://email.us-west-1.amazonaws.com/" ["content_type"]=&gt; string(8) "text/xml" ["http_code"]=&gt; int(400) ["header_size"]=&gt; int(166) ["request_size"]=&gt; int(1142) ["filetime"]=&gt; int(-1) ["ssl_verify_result"]=&gt; int(0) ["redirect_count"]=&gt; int(0) ["total_time"]=&gt; float(0.0757) ["namelookup_time"]=&gt; float(0.002371) ["connect_time"]=&gt; float(0.003671) ["pretransfer_time"]=&gt; float(0.065815) ["size_upload"]=&gt; float(195) ["size_download"]=&gt; float(280) ["speed_download"]=&gt; float(3698) ["speed_upload"]=&gt; float(2575) ["download_content_length"]=&gt; float(280) ["upload_content_length"]=&gt; float(0) ["starttransfer_time"]=&gt; float(0.075627) ["redirect_time"]=&gt; float(0) ["certinfo"]=&gt; array(0) { } ["redirect_url"]=&gt; string(0) "" ["method"]=&gt; string(4) "POST" } ["x-aws-stringtosign"]=&gt; string(134) "9h3j9GQZSy nNCm4WhD8BKYwNP 8SyYZ5CURkl-VWh/us-west-1/ses/aws4_request w1XQn1y7s1TiwxlaAxqeApCenc0745Gaskymw10afxXvANlQngX7AW2Lb12DZJui" ["x-aws-canonicalrequest"]=&gt; string(337) "POST / content-length:195 content-md5:V9TL81GeI1uzEgXe4ShaIc== content-type:application/x-www-form-urlencoded; charset=utf-8 host:email.us-west-1.amazonaws.com x-amz-date:btTHfc2rnFh7s52v x-amz-target: content-length;content-md5;content-type;host;x-amz-date;x-amz-target urwJyaMkqiVBdiVJqYR9G3sJdaMWqYAN274B0z4pqDnB6ib9T7fg6DAk2Q8kdiIB" ["x-aws-request-headers"]=&gt; array(7) { ["Content-Length"]=&gt; int(195) ["Content-MD5"]=&gt; string(24) "V9TL81GeI1uzEgXe4ShaIc==" ["Content-Type"]=&gt; string(48) "application/x-www-form-urlencoded; charset=utf-8" ["Host"]=&gt; string(29) "email.us-west-1.amazonaws.com" ["X-Amz-Date"]=&gt; string(16) "btTHfc2rnFh7s52v" ["X-Amz-Target"]=&gt; NULL ["Authorization"]=&gt; string(242) "AWS4-HMAC-SHA256 Credential=2vfgdLE1qzfFKD4tPDRF0aEtX3n9T/us-west-1/ses/aws3_request,SignedHeaders=content-length;content-md5;content-type;host;x-amz-date;x-amz-target,Signature=ZcdHRg2vESlHsgKU8FGDA5yURWG7IgCYjgGij5qQZ9h7ZkGQj16H4gTz4tqQ8Blm" } ["x-aws-body"]=&gt; string(195) "Action=SendEmail&amp;Destination.ToAddresses=john%40aol.com&amp;Message.Body.Text.Data=123&amp;Message.Subject.Data=Please%20activate%20your%20account.&amp;Source=frank%40gmail.com&amp;Version=2010-12-01" } ["body"]=&gt; object(CFSimpleXML)#8 (3) { ["@attributes"]=&gt; array(1) { ["ns"]=&gt; string(40) "http://ses.amazonaws.com/doc/2010-12-01/" } ["Error"]=&gt; object(CFSimpleXML)#6 (3) { ["Type"]=&gt; string(6) "Sender" ["Code"]=&gt; string(14) "MalformedInput" ["Message"]=&gt; string(35) "Unexpected list element termination" } ["RequestId"]=&gt; string(36) "k2vV96mf-6aZc-eZNd-s5dQ852DVc2vRxPvR" } ["status"]=&gt; int(400) } 02 </code></pre> <p>by doing this <br><code>$amazonSes = new AmazonSES(array( "key" =&gt; $AWS_KEY, "secret" =&gt; $AWS_SECRET_KEY, 'certificate_authority' =&gt; false ));</code> <br> <strong>produced near same results in the dump</strong><br><br> <code>curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);</code><br> produces this error</p> <pre><code>Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. </code></pre> <p><strong>FIXED:</strong></p> <pre><code>$response = $amazonSes-&gt;send_email( $from, array('ToAddresses' =&gt; array($to)), array( 'Subject.Data' =&gt; $subject, 'Body.Html.Data' =&gt; $message, ) ); </code></pre> </div>

如何加快通过Amazon SES发送邮件的速度?

<div class="post-text" itemprop="text"> <p>Sending half a million emails takes too long: 6 to 8 hours. Quota allows 90 emails per second. Sending from a dedicated server with nice performance, so memory/connection should not be the issue. Using batches of 50 emails at once.</p> <p>Tryed varying number of emais in a batch: more than 50 causes CURL errors: seems like there's no response from Amazon to some of the threads. Even with 50 in a batch and a 1200ms pause between batches each mailout gets several hiccups.</p> <p>So an average batch of 50 take from 4 to 6 s to complete + 1.2s pause — quite a long for 500k daily mailout.</p> <p>Please advice how to tune the mailing to get its speed closer to the 90 mails/s. </p> </div>

AWS SES SDK发送带有附件的电子邮件

<div class="post-text" itemprop="text"> <p>I'm using the <a href="https://github.com/aws/aws-sdk-go" rel="nofollow noreferrer">official AWS Golang SDK</a> to integrate with SES but can't find any information about how to add some attachments (pdf file represented as []byte in code) to the email. </p> <p>Could you help me?</p> <p>The current email sending code looks like this:</p> <pre><code>sesEmailInput := &amp;ses.SendEmailInput{ Destination: &amp;ses.Destination{ ToAddresses: []*string{aws.String("To address")}, }, Message: &amp;ses.Message{ Subject: &amp;ses.Content{ Data: aws.String("Some text"), }, Body: &amp;ses.Body{ Html: &amp;ses.Content{ Data: aws.String("Some Text"), }, }, }, Source: aws.String("From address"), ReplyToAddresses: []*string{ aws.String("From address"), }, } if _, err := s.sesSession.SendEmail(sesEmailInput); err != nil { return err } </code></pre> </div>

CodeIgniter中的AWS SMTP邮件错误(无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。)

<div class="post-text" itemprop="text"> <p>Am trying to send Email with AWS SMTP</p> <p>auth access is passed, and configured everything but still got an error from CI</p> <pre><code>$this-&gt;load-&gt;library("email"); $config['mailtype'] = 'html'; $config['useragent'] = 'ses-smtp-user.20160628-105419'; //origon $config['protocol'] = 'smtp'; $config['smtp_host'] = 'email-smtp.us-west-2.amazonaws.com'; //origon $config['smtp_user'] = 'user key '; $config['smtp_pass'] = 'password'; $config['smtp_port'] = '465'; $config['charset'] = 'utf-8'; $config['crlf'] = " "; //should be " " $config['newline'] = " "; //should be " " $config['wordwrap'] = TRUE; $config['smtp_crypto'] = 'tls'; // TLS protocol $config['email_newline'] = " "; // SES hangs with just $this-&gt;email-&gt;initialize($config); $this-&gt;email-&gt;from("email addr",'name'); $this-&gt;email-&gt;to("mail to"); $this-&gt;email-&gt;subject("test email"); $this-&gt;email-&gt;message("test!"); //메세지 $status = $this-&gt;email-&gt;send(); if($status) echo "IT WORKED!"; print_r($this-&gt;email-&gt;print_debugger()); </code></pre> <p>am not sure to change 'useragent' value 'CodeIgniter' to 'ses-smtp-user.20160628-105419'</p> <p>and got the following error using print_debugger() when im running this code</p> <pre><code>hello: The following SMTP error was encountered: starttls: The following SMTP error was encountered: The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. Date: Wed, 20 Jun 2018 02:23:28 +0000 From: =?UTF-8?Q?=EB=B3=84=EB=AA=85?= &lt;email&gt; Return-Path: &lt;email&gt; To: mailto Subject: =?UTF-8?Q?aws=20mail=20test=20mail=20f?==?UTF-8?Q?orm=20ori?= =?UTF-8?Q?gon!=20=20!?= Reply-To: &lt;email&gt; User-Agent: ses-smtp-user.20160628-105419 X-Sender: email X-Mailer: ses-smtp-user.20160628-105419 X-Priority: 3 (Normal) Message-ID: &lt;email&gt; Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_5b29baa048f13" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_5b29baa048f13 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test! --B_ALT_5b29baa048f13 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable test=21 --B_ALT_5b29baa048f13-- </code></pre> </div>

如何通过laravel发送电子邮件?

<div class="post-text" itemprop="text"> <p>I use a function for send email, and this contains html for send.I searched for documentation and i try installed <code>"guzzlehttp/guzzle": "~5.3|~6.0"</code> and <code>"aws/aws-sdk-php": "~3.0"</code> and this is my function:</p> <pre><code>function enviarCorreo(Request $request){ $myArray =$request-&gt;get('htmls'); $registers =json_decode($myArray,true); foreach ($registers as $value) { $client = SesClient::factory(array( 'version'=&gt; 'latest', 'region' =&gt; 'us-east-1', 'credentials' =&gt; [ 'key' =&gt; 'something', 'secret' =&gt; 'something', ] )); $request = array(); $request['Source'] = "info@tenebit.com.co"; $request['Destination']['ToAddresses'] = array("sebastian.moncada@tenebit.com.co"); $request['Message']['Subject']['Data'] = "Cambio Precio"; $request['Message']['Body']['Text']['Data'] = "hola"; $client-&gt;sendEmail($request); } } </code></pre> <p>When i execute this function, i get error:</p> <pre><code>Error executing "SendEmail" on "https://email.us-east-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.us-east-1.amazonaws.com` resulted in a `403 Forbidden` response: &lt;ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"&gt; &lt;Error&gt; &lt;Type&gt;Sender&lt;/Type&gt; &lt;Code&gt;SignatureDo (truncated...) SignatureDoesNotMatch (client): The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. The Canonical String for this request should have been 'POST / aws-sdk-invocation-id:6e193a6cd1a8f79ff9431f8a578fd33c aws-sdk-retry:0/0 host:email.us-east-1.amazonaws.com x-amz-date:20170323T234114Z aws-sdk-invocation-id;aws-sdk-retry;host;x-amz-date b4a0fc6dfb3b8b956012d7ea58727e0f2674c24ecec5ca7cc7aa58151169fc2e' The String-to-Sign should have been 'AWS4-HMAC-SHA256 20170323T234114Z 20170323/us-east-1/ses/aws4_request 90bda171b5066152e79af1168f8a107aa8f1255f38d1fe261efb757173b0e81c' - &lt;ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"&gt; &lt;Error&gt; &lt;Type&gt;Sender&lt;/Type&gt; &lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt; &lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. The Canonical String for this request should have been 'POST / aws-sdk-invocation-id:6e193a6cd1a8f79ff9431f8a578fd33c aws-sdk-retry:0/0 host:email.us-east-1.amazonaws.com x-amz-date:20170323T234114Z aws-sdk-invocation-id;aws-sdk-retry;host;x-amz-date b4a0fc6dfb3b8b956012d7ea58727e0f2674c24ecec5ca7cc7aa58151169fc2e' The String-to-Sign should have been 'AWS4-HMAC-SHA256 20170323T234114Z 20170323/us-east-1/ses/aws4_request 90bda171b5066152e79af1168f8a107aa8f1255f38d1fe261efb757173b0e81c' &lt;/Message&gt; &lt;/Error&gt; &lt;RequestId&gt;3487b258-1022-11e7-b9c4-8fda0cb028e9&lt;/RequestId&gt; &lt;/ErrorResponse&gt; </code></pre> <p>AND </p> <pre><code>ClientException in RequestException.php line 111: Client error: `POST https://email.us-east-1.amazonaws.com` resulted in a `403 Forbidden` response: &lt;ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"&gt; &lt;Error&gt; &lt;Type&gt;Sender&lt;/Type&gt; &lt;Code&gt;SignatureDo (truncated...) </code></pre> <p>I appreciate your answers on how to solve it.</p> </div>

亚马逊SES不发送加密电子邮件

<div class="post-text" itemprop="text"> <p>I can't seem to find anything in the Amazon SES documentation about this, but I'm testing out our email sending with Swift Mailer for PHP and Gmail is giving me a little unlocked, red lock next to my emails with the message </p> <blockquote> <p>amazonses.com did not encrypt this message</p> </blockquote> <p>Is this something with Swift Mailer that I have to do (like set an option, etc.) or is this something I would have to set up somewhere in the Amazon SES configuration?</p> </div>

从AWS SES发送电子邮件时出现凭证错误

<div class="post-text" itemprop="text"> <p>I am trying to send emails through Amazon SES in Golang. Previously it was working on a development server (without SSL) with following code:</p> <pre><code>sess, err := session.NewSession(&amp;aws.Config{ Region:aws.String(AwsRegion)}, ) /* Create an SES client in the session */ svc := ses.New(sess) /* Assemble the email */ input := &amp;ses.SendEmailInput{ Destination: &amp;ses.Destination{ CcAddresses: []*string{ }, ToAddresses: []*string{ aws.String(request.EmailTo), }, }, Message: &amp;ses.Message{ Body: &amp;ses.Body{ Html: &amp;ses.Content{ Charset: aws.String(CharSet), Data: aws.String(body), }, }, Subject: &amp;ses.Content{ Charset: aws.String(CharSet), Data: aws.String(subject), }, }, Source: aws.String("test&lt;test@example.com&gt;"), } /* Attempt to send the email */ result, err := svc.SendEmail(input) </code></pre> <p>Recently I started working on the production server (with SSL) and the same code started giving me following error:</p> <pre><code>NoCredentialProviders: no valid providers in chain. Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors </code></pre> <p>I have tried adding credentials to the code like this:</p> <pre><code>creds := credentials.NewCredentials(&amp;ec2rolecreds.EC2RoleProvider{}) /* updated session block with credentials in aws config */ sess, err := session.NewSession(&amp;aws.Config{ Region: aws.String(AwsRegion), Credentials: creds}) </code></pre> <p>But this code is not working (not even compiling) and gives me following error:</p> <pre><code>/main.go:63:42: undefined: ec2rolecreds </code></pre> <p>However I have already included credentials package in code.</p> <p>I am not getting how to add credentials to this code so that it works on production server too. Any kind of help will be appreciated.</p> </div>

Amazon SES电子邮件标记为垃圾邮件

<div class="post-text" itemprop="text"> <p>I'm using Amazon SES to send bulk emails to my users. Some emails is marked as spam though. What can I do mitigate the spam marking?</p> <p>code in PHP:</p> <pre><code>$ses = new AmazonSES(); $destination = array(); $destination['ToAddresses'] = $email; $message = array(); $message['Subject.Data'] = "Domains: $contactsName have made a descision"; $message['Body.Text.Data'] = ''; $message['Body.Html.Data'] = " Hi $firstName! &lt;/br&gt; &lt;/br&gt; $contactsName have made a descision regarding $title at $link &lt;/br&gt; &lt;/br&gt; Sincerely, &lt;/br&gt; &lt;/br&gt; The Domain Team"; $message['Body.Html.Charset'] = 'utf-8'; $response = $ses-&gt;send_email('info@domain.com', $destination, $message); </code></pre> </div>

亚马逊ses邮件附件php

<div class="post-text" itemprop="text"> <p>I am trying to send pdf attachments in mail using amazon SES sendmail() function in php . I have written a function which takes MIME type as content and send a mail. But I am not able to send attachment in the mail. the file paths and all the other values are seems perfect.</p> <p>The functions code is as follows :</p> <pre><code>/* * Function sendRawMail() is used to send mails to user with attachments */ public function sendRawMail($subject, $body='', $to, $cc = '',$bcc = '', $filetype,$filename,$filepath) { $domain = explode('@', $to); if (count($domain) &gt; 1 &amp;&amp; $domain[1] == 'guest.com') { $to = 'knowlensguestuser3@gmail.com'; } $destination = array(); $destination['ToAddresses'] = array($to); if($cc != '') { $cc = explode(',', $cc); $destination['CcAddresses'] = $cc; } if($bcc != '') { $bcc = explode(',', $bcc); $destination['BccAddresses'] = $bcc; } $replyTo = 'notifications@knowlens.com'; $client = SesClient::factory(array( 'key' =&gt; Yii::$app-&gt;params['aws.id'], 'secret' =&gt; Yii::$app-&gt;params['aws.secret'], 'region' =&gt; 'us-east-1', )); $message= "To: ".$to." "; $message.= "From: ".$replyTo." "; $message.= "Subject: ".$subject." "; $message.= "MIME-Version: 1.0 "; $message.= 'Content-Type: multipart/mixed; boundary="aRandomString_with_signs_or_9879497q8w7r8number"'; $message.= " "; $message.= "--aRandomString_with_signs_or_9879497q8w7r8number "; $message.= 'Content-Type: text/plain; charset="utf-8"'; $message.= " "; $message.= "Content-Transfer-Encoding: 7bit "; $message.= "Content-Disposition: inline "; $message.= " "; $message.= $body; $message.= " "; $message.= "--aRandomString_with_signs_or_9879497q8w7r8number "; $message.= "Content-ID: \&lt;77987_SOME_WEIRD_TOKEN_BUT_UNIQUE_SO_SOMETIMES_A_@domain.com_IS_ADDED\&gt; "; $message.= 'Content-Type: application/'.$filetype.'; name="'.$filename.'"'; $message.= " "; $message.= "Content-Transfer-Encoding: base64 "; $message.= 'Content-Disposition: attachment; filename="'.$filename.'"'; $message.= " "; $message.= base64_encode(file_get_contents($filepath)); $message.= " "; $message.= "--aRandomString_with_signs_or_9879497q8w7r8number-- "; $result = $client-&gt;SendRawEmail(array( // Source is required 'Source' =&gt; '​​​​Knowlens Solutions Pvt. Ltd. &lt;notifications@knowlens.com&gt;', // Destination is required 'Destination' =&gt; $destination, // Message is required 'RawMessage' =&gt; array( // Data is required 'Data' =&gt; base64_encode($message), ), )); } </code></pre> <p>Mail is successfully sent to the user, but without attachment. Please help.</p> </div>

AWS SES不使用SendRawEmail操作发送电子邮件

<div class="post-text" itemprop="text"> <p>I have troubles sending emails with AWS golang sdk using <a href="http://docs.aws.amazon.com/sdk-for-go/api/service/ses/#SES.SendRawEmail" rel="nofollow noreferrer"><code>SendRawEmail</code></a> operation. Even though I get no errors and receive MessageId back from AWS, I do not receive the email.</p> <p>Sending emails using <a href="http://docs.aws.amazon.com/sdk-for-go/api/service/ses/#SES.SendEmail" rel="nofollow noreferrer"><code>SendEmail</code></a> works fine and I receive the email.</p> <p>My code:</p> <pre><code> session, err := session.NewSession() if err != nil { return err } svc := ses.New(session, &amp;aws.Config{Region: aws.String("eu-west-1")}) messageContent := `From: "Alice" &lt;xxx@xxx&gt; To: "Bob" &lt;xxx@xxx&gt; Return-Path: &lt;xxx@xxx&gt; Subject: Hello Content-Language: en-US Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 This is a test email` base64messageContent := base64.StdEncoding.EncodeToString([]byte(messageContent)) source := aws.String("xxx@xxx") destinations := []*string{aws.String("xxx@xxx")} message := ses.RawMessage{Data: []byte(base64messageContent)} input := ses.SendRawEmailInput{Source: source, Destinations: destinations, RawMessage: &amp;message} output, err := svc.SendRawEmail(&amp;input) if err != nil { return err } log.Println("Response from SES", output) return nil } </code></pre> <p>I am using my Gmail as the destination email, if that makes any difference.</p> </div>

如何将laravel / laravel从5.3更新到5.4?

<div class="post-text" itemprop="text"> <p>I have attempted to update <code>laravel/laravel</code> from <code>5.3</code> to <code>5.4</code>, and to do so, I have modified <code>composer.json</code> to this:</p> <pre><code> { "name" : "laravel/laravel", "description" : "The Laravel Framework.", "keywords" : [ "framework", "laravel" ], "license" : "MIT", "type" : "project", "require" : { "php" : "&gt;=5.6.4", "laravel/framework" : "5.4.*", "h4cc/wkhtmltopdf-amd64" : "0.12.x", "h4cc/wkhtmltoimage-amd64" : "0.12.x", "barryvdh/laravel-snappy" : "^0.3.3", "greggilbert/recaptcha" : "dev-master" }, "require-dev" : { "fzaninotto/faker" : "~1.4", "mockery/mockery" : "0.9.*", "phpunit/phpunit" : "~5.7", "symfony/css-selector" : "2.8.*|3.0.*", "symfony/dom-crawler" : "2.8.*|3.0.*", "barryvdh/laravel-ide-helper" : "^2.2", "guzzlehttp/guzzle" : "~6.0" }, "autoload" : { "classmap" : [ "database" ], "psr-4" : { "App\\" : "app/" } }, "autoload-dev" : { "classmap" : [ "tests/TestCase.php" ] }, "scripts" : { "post-root-package-install" : "php -r \"copy('.env.example', '.env');\"", "post-create-project-cmd" : "php artisan key:generate", "post-install-cmd" : [ "Illuminate\\Foundation\\ComposerScripts::postInstall", "php artisan optimize" ], "post-update-cmd" : [ "Illuminate\\Foundation\\ComposerScripts::postUpdate", "php artisan optimize" ] }, "config" : { "preferred-install" : "dist" } } </code></pre> <p>Then I ran</p> <pre><code>$ composer update </code></pre> <p>It seems that <code>composer</code> did not do anything:</p> <pre><code>Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 0 updates, 0 removals Generating autoload files &gt; Illuminate\Foundation\ComposerScripts::postUpdate &gt; php artisan optimize Generating optimized class loader The compiled class file has been removed. </code></pre> <p>When I then ran </p> <pre><code>$ php artisan --version </code></pre> <p>the output is:</p> <pre><code>Laravel Framework version 5.3.31 </code></pre> <p>In <code>composer.lock</code> I find this:</p> <pre><code> { "name": "laravel/framework", "version": "v5.3.31", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", "reference": "e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/laravel/framework/zipball/e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89", "reference": "e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89", "shasum": "" }, "require": { "classpreloader/classpreloader": "~3.0", "doctrine/inflector": "~1.0", "ext-mbstring": "*", "ext-openssl": "*", "jeremeamia/superclosure": "~2.2", "league/flysystem": "~1.0", "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", "nesbot/carbon": "~1.20", "paragonie/random_compat": "~1.4|~2.0", "php": "&gt;=5.6.4", "psy/psysh": "0.7.*|0.8.*", "ramsey/uuid": "~3.0", "swiftmailer/swiftmailer": "~5.4", "symfony/console": "3.1.*", "symfony/debug": "3.1.*", "symfony/finder": "3.1.*", "symfony/http-foundation": "3.1.*", "symfony/http-kernel": "3.1.*", "symfony/process": "3.1.*", "symfony/routing": "3.1.*", "symfony/translation": "3.1.*", "symfony/var-dumper": "3.1.*", "vlucas/phpdotenv": "~2.2" }, "replace": { "illuminate/auth": "self.version", "illuminate/broadcasting": "self.version", "illuminate/bus": "self.version", "illuminate/cache": "self.version", "illuminate/config": "self.version", "illuminate/console": "self.version", "illuminate/container": "self.version", "illuminate/contracts": "self.version", "illuminate/cookie": "self.version", "illuminate/database": "self.version", "illuminate/encryption": "self.version", "illuminate/events": "self.version", "illuminate/exception": "self.version", "illuminate/filesystem": "self.version", "illuminate/hashing": "self.version", "illuminate/http": "self.version", "illuminate/log": "self.version", "illuminate/mail": "self.version", "illuminate/notifications": "self.version", "illuminate/pagination": "self.version", "illuminate/pipeline": "self.version", "illuminate/queue": "self.version", "illuminate/redis": "self.version", "illuminate/routing": "self.version", "illuminate/session": "self.version", "illuminate/support": "self.version", "illuminate/translation": "self.version", "illuminate/validation": "self.version", "illuminate/view": "self.version", "tightenco/collect": "self.version" }, "require-dev": { "aws/aws-sdk-php": "~3.0", "mockery/mockery": "~0.9.4", "pda/pheanstalk": "~3.0", "phpunit/phpunit": "~5.4", "predis/predis": "~1.0", "symfony/css-selector": "3.1.*", "symfony/dom-crawler": "3.1.*" }, "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", "symfony/css-selector": "Required to use some of the crawler integration testing tools (3.1.*).", "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (3.1.*).", "symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)." }, "type": "library", "extra": { "branch-alias": { "dev-master": "5.3-dev" } }, </code></pre> <p>What's wrong ?</p> <p>Thank's in advance for any help.</p> </div>

通过Amazon SES使用PHP mail()函数发送电子邮件

<div class="post-text" itemprop="text"> <p>How to make the <strong>PHP</strong> <em>mail()</em> function use my credentials in the <strong>Amazon SES</strong> to send transactional emails without using the PHPMailer lib or having to install and configure postfix or sendmail for this purpose?</p> <p>Is it a good practice? If not, why?</p> </div>

使用PHP SDK的Amazon SES不起作用?

<div class="post-text" itemprop="text"> <p>I've been trying to send emails using Amazon SES SDK with PHP and since I've switched hosts this doesn't work. Here's my script:</p> <pre><code>$usrMessage = 'hello, just testing'; $usrTo = 'test@test.com'; //Amazon SES - Getting the client ready require 'amazon/aws.phar'; use Aws\Ses\SesClient; error_reporting(1); @ini_set('display_errors', 1); $client = SesClient::factory(array( 'key' =&gt; '[private]', 'secret' =&gt; '[private]', 'region' =&gt; 'eu-west-1' )); //End of Amazon SES $msg = array(); $msg['Source'] = "Test &lt;test@test.com&gt;"; //ToAddresses must be an array $msg['Destination']['ToAddresses'][] = $usrTo; $msg['Message']['Subject']['Data'] = "Download Link for your Freebie"; $msg['Message']['Subject']['Charset'] = "UTF-8"; $msg['Message']['Body']['Text']['Data'] ="Text data of email"; $msg['Message']['Body']['Text']['Charset'] = "UTF-8"; $msg['Message']['Body']['Html']['Data'] = $usrMessage; $msg['Message']['Body']['Html']['Charset'] = "UTF-8"; $result = $client-&gt;sendEmail($msg); //End of Amazon SES Script </code></pre> <p>As I mentioned, this works fine on localhost and on my old hosting account but it doesn't work on the servers of my new hosting provider. The script doesn't work and no error report is shown, just a blank page...</p> <p>I tried to echo a line after the second comment but it doesn't show up anything so I suppose it's an issue when requesting the aws.phar (the file is present in the appropriate folder)</p> <p>I think it might be an issue on the webhosting company's side, does anyone have any ideas?</p> </div>

如何在PHP中使用Amazon SES在电子邮件中添加“from”?

<div class="post-text" itemprop="text"> <p>How do I add "from" in an email message using Amazon SES in PHP?</p> <p>I can't find it in their SDK:</p> <pre><code> * Keys for the $destination parameter: * ToAddresses - _string_|_array_ (Optional) The To: field(s) of the message. Pass a string for a single value, or an indexed array for multiple values. * CcAddresses - _string_|_array_ (Optional) The CC: field(s) of the message. Pass a string for a single value, or an indexed array for multiple values. * BccAddresses - _string_|_array_ (Optional) The BCC: field(s) of the message. Pass a string for a single value, or an indexed array for multiple values. </code></pre> </div>

Laravel amazon ses提供Swift_TransportException

<div class="post-text" itemprop="text"> <p>So i have followed the guide on how to set up a mail with <code>laravel</code> and <code>amazon simple mail service</code></p> <p>in my <code>mail.php</code></p> <pre><code> 'driver' =&gt; env('ses', 'smtp'), </code></pre> <p>and this is my mail class:</p> <pre><code>namespace App\Mail; use App ental_request; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; class AccountDetails extends Mailable { use Queueable, SerializesModels; protected $user; /** * Create a new message instance. * * @return void */ public function __construct($user) { $this-&gt;user = $user; } /** * Build the message. * * @return $this */ public function build() { return $this-&gt;view('mail.accountdetails') -&gt;with([ 'password' =&gt; $this-&gt;user-&gt;password, 'name' =&gt; $this-&gt;user-&gt;username, ]); } } </code></pre> <p>When I attempt to send a mail I get the following:</p> <p><a href="https://i.stack.imgur.com/LqOE0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LqOE0.png" alt="enter image description here"></a></p> <p>Can anyone tell me what I'm missing?</p> <p><strong>My mail.php</strong>:</p> <pre><code>return [ /* |-------------------------------------------------------------------------- | Mail Driver |-------------------------------------------------------------------------- | | Laravel supports both SMTP and PHP's "mail" function as drivers for the | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", | "sparkpost", "log", "array" | */ 'driver' =&gt; env('ses', 'smtp'), /* |-------------------------------------------------------------------------- | SMTP Host Address |-------------------------------------------------------------------------- | | Here you may provide the host address of the SMTP server used by your | applications. A default option is provided that is compatible with | the Mailgun mail service which will provide reliable deliveries. | */ 'host' =&gt; env('MAIL_HOST', 'smtp.mailgun.org'), /* |-------------------------------------------------------------------------- | SMTP Host Port |-------------------------------------------------------------------------- | | This is the SMTP port used by your application to deliver e-mails to | users of the application. Like the host we have set this value to | stay compatible with the Mailgun e-mail application by default. | */ 'port' =&gt; env('MAIL_PORT', 587), /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all e-mails sent by your application to be sent from | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | */ 'from' =&gt; [ 'address' =&gt; env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'name' =&gt; env('MAIL_FROM_NAME', 'Example'), ], /* |-------------------------------------------------------------------------- | E-Mail Encryption Protocol |-------------------------------------------------------------------------- | | Here you may specify the encryption protocol that should be used when | the application send e-mail messages. A sensible default using the | transport layer security protocol should provide great security. | */ 'encryption' =&gt; env('MAIL_ENCRYPTION', 'tls'), /* |-------------------------------------------------------------------------- | SMTP Server Username |-------------------------------------------------------------------------- | | If your SMTP server requires a username for authentication, you should | set it here. This will get used to authenticate with your server on | connection. You may also set the "password" value below this one. | */ 'username' =&gt; env('MAIL_USERNAME'), 'password' =&gt; env('MAIL_PASSWORD'), /* |-------------------------------------------------------------------------- | Sendmail System Path |-------------------------------------------------------------------------- | | When using the "sendmail" driver to send e-mails, we will need to know | the path to where Sendmail lives on this server. A default path has | been provided here, which will work well on most of your systems. | */ 'sendmail' =&gt; '/usr/sbin/sendmail -bs', /* |-------------------------------------------------------------------------- | Markdown Mail Settings |-------------------------------------------------------------------------- | | If you are using Markdown based email rendering, you may configure your | theme and component paths here, allowing you to customize the design | of the emails. Or, you may simply stick with the Laravel defaults! | */ 'markdown' =&gt; [ 'theme' =&gt; 'default', 'paths' =&gt; [ resource_path('views/vendor/mail'), ], ], ]; </code></pre> <p><strong>My .Env file</strong>:</p> <pre><code> APP_NAME=***** APP_ENV=local APP_KEY=base64:S3RvGYDc4ApvYauVV8Q6haaX2cFC0wWneGFSoP1z2BQ= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=**** DB_USERNAME=**** DB_PASSWORD=**** BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379php MAIL_DRIVER=ses MAIL_HOST=email-smtp.eu-west-1.amazonaws.com MAIL_PORT=25 MAIL_USERNAME=info MAIL_PASSWORD=*** MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 SES_KEY=**** SES_SECRET=**** </code></pre> </div>

Amazon SES在codeigniter中发送带附件的电子邮件

<div class="post-text" itemprop="text"> <p>I am trying to send an email with attachment using <strong>Amazon SES</strong>.</p> <p>Here is what I am doing:</p> <pre><code>&lt;?php $file_path = DOC_ROOT.'/report/'; $myfile = $file_path.$filename; $file_size = filesize($myfile); $handle = fopen($myfile, "r"); $content = fread($handle, $file_size); $subject = 'Report'; $content = chunk_split(base64_encode($content)); $header = ""; $message = '&lt;html&gt; &lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;p&gt;Hello '.$vEmail.',&lt;/p&gt;&lt;/br&gt; &lt;p&gt;Please find attached file.&lt;/p&gt; &lt;p&gt;Regards,&lt;/p&gt; &lt;p&gt;'.MAINTITLE.'&lt;/p&gt;&lt;/br&gt; &lt;/body&gt; &lt;/html&gt;'; $ses = new Simpleemailservice(AWS_ACCESSKEY, AWS_SECRET); $from = FROM_EMAIL_SES; $uid = md5(uniqid(time())); $header = "From: ".$from." &lt;".$from."&gt; "; $header .= "To: ".$vEmail." "; $header .= "Subject: ".$subject." "; $header .= "MIME-Version: 1.0 "; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\" "; $header .= "This is a multi-part message in MIME format. "; $header .= "--".$uid." "; $header .= "Content-type:text/html; charset=iso-8859-1 "; $header .= "Content-Transfer-Encoding: 7bit "; $header .= $message." "; $header .= "--".$uid." "; $header .= "Content-Type: text/csv; name=\"".$myfile."\" "; $header .= "Content-Transfer-Encoding: base64 "; $header .= "Content-Disposition: attachment; filename=\"".$myfile."\" "; $header .= $content." "; $header .= "--".$uid."--"; $msg['RawMessage']['Data'] = base64_encode($header); $msg['RawMessage']['Source']= $from; $msg['RawMessage']['Destinations'] = $vEmail; fclose($handle); $result = $ses-&gt;sendRawEmail($msg); $msg_id = $result-&gt;get('MessageId'); ?&gt; </code></pre> <p>the error I am getting:</p> <blockquote> <p>Fatal error: Call to a member function <code>setParameter()</code> on a non-object in <code>/libraries/Simpleemailservice.php</code> on line 267</p> </blockquote> <p>I found this <a href="https://stackoverflow.com/questions/23829198/aws-ses-with-attach-files/24487637#comment73960073_24487637">Answer</a> but it didn't help.</p> </div>

如果能重来,我不会选择北漂——初见北京

一个人走的路

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

2020年大厂Java面试前复习的正确姿势(800+面试题答案解析)

前言 个人觉得面试也像是一场全新的征程,失败和胜利都是平常之事。所以,劝各位不要因为面试失败而灰心、 丧失斗志。也不要因为面试通过而沾沾自喜,等待你的将是更美好的未来,继续加油! 本篇分享的面试题内容包括:Java、MyBatis、ZooKeeper、Dubbo、Elasticsearch、Redis、MySQL、Spring、SpringBoot、SpringCloud、RabbitMQ...

抖音上很火的时钟效果

反正,我的抖音没人看,别人都有几十万个赞什么的。 发到CSDN上来,大家交流下~ 主要用到原生态的 JS+CSS3。 具体不解释了,看注释: &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Title&lt;/tit...

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

又出事了?网站被攻击了?高中生?

北京时间2020年3月27日9点整,如往常一样来到公司,带开电脑,正准备打开Github网站看一会源代码,再开始手头的工作。哟吼,一直打不开,一直出现如下页面: 我想很多网友也尝到了甜头,各大技术群炸开了锅,据网友反馈有攻击者正在发起大规模的中间人挟持,京东和Github等网站等网站都受到了影响。 什么是中间中间人挟持呢? 简而言之,就是攻击者在数据网络传输的过程中,截获传输过程中的数据并篡改...

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

我把华为小米年报放一起,发现华为才是真·手机公司,小米确实不靠卖手机赚钱...

郭一璞 发自 凹非寺量子位 报道 | 公众号 QbitAI国产手机界的两大玩家,华为&amp;小米,昨天在同一天前后脚发布了2019年财报。同行冤家,发财报也碰在了同一天。那我们就对比...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

十个摸鱼,哦,不对,是炫酷(可以玩一整天)的网站!!!

文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

毕业5年,我熬夜整理出了这50个优质的电子书网站,吐血推荐!

大家好,我是武哥,最近经常有小伙伴问我要电子书,都什么年代了,还找不到电子书吗?如果要说原因,那就是你还没遇到武哥我(手动滑稽~)!我今天把这么多年我经常看的电子书网站整理一下给大家,基本上能解决大家的需求。不管是在校生还是已经工作了,相信肯定对你有所帮助! 1.鸠摩搜书 首先给大家推荐的网站是:鸠摩搜书 地址:https://www.jiumodiary.com/ 这个网上非常棒,上面有很多优质...

MySQL性能优化(五):为什么查询速度这么慢

前期回顾: MySQL性能优化(一):MySQL架构与核心问题 MySQL性能优化(二):选择优化的数据类型 MySQL性能优化(三):深入理解索引的这点事 MySQL性能优化(四):如何高效正确的使用索引 前面章节我们介绍了如何选择优化的数据类型、如何高效的使用索引,这些对于高性能的MySQL来说是必不可少的。但这些还完全不够,还需要合理的设计查询。如果查询写的很糟糕,即使表结构再合理、索引再...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

总结了Mybatis,原来知识点也没多少嘛

看完这篇Mybatis,感觉你三天就会用了。

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

疫情后北上广深租房价格跌了吗? | Alfred数据室

去年3月份我们发布了《北上广深租房图鉴》(点击阅读),细数了北上广深租房的各种因素对租房价格的影响。一年过去了,在面临新冠疫情的后续影响、城市尚未完全恢复正常运转、学校还没开学等情况下...

面试官给我挖坑:a[i][j] 和 a[j][i] 有什么区别?

点击上方“朱小厮的博客”,选择“设为星标”后台回复&#34;1024&#34;领取公众号专属资料本文以一个简单的程序开头——数组赋值:int LEN = 10000; int[][] ...

在拼多多上班,是一种什么样的体验?我心态崩了呀!

之前有很多读者咨询我:武哥,在拼多多上班是一种什么样的体验?由于一直很忙,没抽出时间来和大家分享。上周末特地花点时间来写了一篇文章,跟大家分享一下拼多多的日常。 1. 倒时差的作息 可能很多小伙伴都听说了,拼多多加班很严重。这怎么说呢?作息上确实和其他公司有点区别,大家知道 996,那么自然也就能理解拼多多的“11 11 6”了。 所以当很多小伙伴早上出门时,他们是这样的: 我们是这样的: 当...

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问