コード例 #1
0
ファイル: Sender.php プロジェクト: trevorpao/f3cms
 /**
  * adapter for SMTP
  *
  * @param string $subject
  * @param string $content
  * @param email  $receiver
  *
  * @return string done or error message
  */
 static function sendmail($subject, $content, $receiver)
 {
     $to_address = $receiver == "" ? f3()->get('inquiry_receiver') : $receiver;
     $smtp = new \SMTP(f3()->get('smtp_host'), f3()->get('smtp_port'), 'SSL', f3()->get('smtp_account'), f3()->get('smtp_password'));
     $smtp->set('From', '"' . f3()->get('smtp_name') . '" <' . f3()->get('smtp_account') . '>');
     $smtp->set('To', '<' . $to_address . '>');
     $smtp->set('Subject', $subject);
     $smtp->set('Errors-to', '<' . f3()->get('smtp_account') . '>');
     $smtp->set('Content-Type', 'text/html');
     $sent = $smtp->send($content, TRUE);
     $mylog = $smtp->log();
     if ($sent) {
         return 'Done';
     } else {
         return $mylog;
     }
 }
コード例 #2
0
 $user->load(array('email = :username LIMIT 0,1', ':username' => $username));
 if ($user->dry()) {
     $user->role = 'subscriber';
     $user->created = date('Y-m-d H:i:s');
     // Send email to Admin with the good news: a new user!
     $smtp = new SMTP(SMTP_SERVER, SMTP_PORT, SMTP_PROTOCOL, SMTP_USERNAME, SMTP_PASSWORD);
     $smtp->set('From', '"Do Not Forget Me" <' . ADMIN_EMAIL . '>');
     $smtp->set('To', '<' . ADMIN_EMAIL . '>');
     $smtp->set('Subject', 'Yay, New DNFM User : '******'Errors-to', '<' . ADMIN_EMAIL . '>');
     $message = "On " . date('Y-m-d at H:i') . ", a new user subscribed to Do Not Forget Me!";
     $message .= "\n\nname: " . $user_profile->displayName;
     $message .= "\nemail: " . $user_profile->email;
     $message .= "\n\n\nPop up the champaign!";
     $sent = $smtp->send($message, TRUE);
     $mylog = $smtp->log();
 }
 $user->email = $username;
 if (!empty($user_profile->displayName)) {
     $user->name = $user_profile->displayName;
 }
 if (!empty($user_profile->firstName)) {
     $user->first = $user_profile->firstName;
 }
 if (!empty($user_profile->photoURL)) {
     $user->image = $user_profile->photoURL;
 }
 $user->save();
 $f3->set('SESSION.name', $user->name);
 $f3->set('SESSION.id', $user->id);
 $f3->set('SESSION.first', $user->first);