Inheritance: extends RpcAcsRequest
Exemplo n.º 1
0
 /**
  * Send mail
  * @param Mail $mail
  * @return bool true if the mail was successfully accepted for delivery, false otherwise.
  */
 public function send(Mail $mail)
 {
     $iClientProfile = DefaultProfile::getProfile($this->config['region'], $this->config['accessKey'], $this->config['accessSecret']);
     $client = new DefaultAcsClient($iClientProfile);
     $request = new Dm\SingleSendMailRequest();
     $request->setAccountName($this->config['accountName']);
     $request->setFromAlias($this->config['alias']);
     $request->setAddressType(1);
     $request->setTagName($this->config['tagName']);
     $request->setReplyToAddress("true");
     $request->setToAddress($mail->to);
     $request->setSubject($mail->subject);
     $request->setHtmlBody($mail->content);
     $response = $client->getAcsResponse($request);
     return true;
 }
 protected function sendSingle(\Swift_Mime_Message $message)
 {
     $request = new DM\SingleSendMailRequest();
     $request->setAccountName($this->accountName);
     //控制台创建的发信地址
     $request->setFromAlias($this->accountAlias);
     $request->setAddressType(1);
     $request->setReplyToAddress('true');
     $request->setToAddress($this->getToAddress($message));
     $request->setSubject($message->getSubject());
     $request->setHtmlBody($message->getBody());
     $this->createClient()->getAcsResponse($request);
     return 1;
 }