本文整理汇总了PHP中Mail::from方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::from方法的具体用法?PHP Mail::from怎么用?PHP Mail::from使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::from方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public static function initialize($delegate, $value, $user="", $pass="", $from=""){
self::$delegate = $delegate;
self::$value = $value;
self::$user = $user;
self::$pass = $pass;
self::$from = $from;
}
示例2: template_new_gameserver_mail
public static function template_new_gameserver_mail($param, $is_resend = false)
{
$param = json_decode(json_encode($param), FALSE);
$user_name = str_replace('@gameloft.com', '', $_SERVER['REMOTE_USER']);
$user_name = str_replace('.', ' ', ucfirst($user_name));
//$cc[] = MAIL_MEX;
foreach ($param as $key => $value) {
unset($to);
unset($cc);
unset($bcc);
$to[] = ENVIRONMENT == LOCAL || ENVIRONMENT == BETA ? $_SERVER['REMOTE_USER'] : MAIL_OGI;
$cc[] = ENVIRONMENT == LOCAL || ENVIRONMENT == BETA ? $_SERVER['REMOTE_USER'] : MAIL_MEX;
$dolly_users = explode(',', $param->{$key}->dolly_users);
foreach ($dolly_users as $key2 => $value2) {
if (array_search($value2, $dolly_users)) {
if ($value2 == $param->{$key}->requested_by) {
unset($dolly_users[$key2]);
} else {
$cc[] = $value2;
}
}
}
$product = Product::load($param->{$key}->product_id)->to_array();
$product_name = $product['name'];
$tpl = $param->{$key};
$tpl->server_type = $key;
$tpl->comments = $param->{$key}->comments_ogi;
$tpl->dolly_users = $param->{$key}->dolly_users;
//Get email template
ob_start();
$subject = '[TUNA][chklst] ' . $param->{$key}->environment . ' ' . $key . ' checklist for ' . $product_name;
include 'mail_templates/new_gameserver_checklist.php';
$body = ob_get_contents();
ob_end_clean();
$m = new Mail('text/plain');
$m->from($_SERVER['REMOTE_USER']);
$m->to(@implode(',', $to));
$m->cc(@implode(',', $cc));
$m->bcc(@implode(',', $bcc));
$m->subject($subject);
$m->body($body);
$m->send();
}
TunaLog::info_log(__CLASS__, __FUNCTION__, $_SERVER['REMOTE_USER'], '');
}
示例3: from
public static function from($mail, $name = null)
{
self::$from = self::format($mail, $name);
}
示例4: tryToSendTheMailOrThrowARuntimeException
/**
* @param Mail $mail
* @throws RuntimeException
*/
public function tryToSendTheMailOrThrowARuntimeException(Mail $mail)
{
$couldNotSent = !mail($mail->to(), $mail->subject(), $mail->content(), 'From: ' . $mail->from());
if ($couldNotSent) {
throw new RuntimeException('could not sent the mail' . PHP_EOL . 'values: ' . var_export($mail, true));
}
}
示例5: forgottenPassword
/**
* Display and treat the form when the user forgot his password
*/
public function forgottenPassword()
{
$form = new Form(array('id' => 'forgotten-password-form', 'fieldsets' => array('form' => array(new EmailInput(array('name' => 'email', 'required' => true, 'label' => Lang::get($this->_plugin . '.forgotten-pwd-form-email-label')))), 'submits' => array(new SubmitInput(array('name' => 'valid', 'label' => Lang::get($this->_plugin . '.valid-button'))), new ButtonInput(array('name' => 'cancel', 'label' => Lang::get($this->_plugin . '.cancel-button'), 'href' => App::router()->getUri('login'), 'target' => 'dialog')))), 'onsuccess' => '
app.dialog(app.getUri("reset-password"));
app.notify("warning", Lang.get("main.forgotten-pwd-sent-email-message"));
'));
if (!$form->submitted()) {
Lang::addKeysToJavascript($this->_plugin . '.forgotten-pwd-sent-email-message');
return Dialogbox::make(array('title' => Lang::get($this->_plugin . '.forgotten-pwd-form-title'), 'icon' => 'lock-alt', 'page' => $form));
} else {
if ($form->check()) {
$user = User::getByEmail($form->getData('email'));
if (!$user) {
// The user does not exists. For security reasons,
// reply the email was successfully sent, after a random delay to work around robots
usleep(mt_rand(0, 500) * 100);
return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.forgotten-pwd-sent-email-message'));
}
try {
// The user exists, send an email with a 6 chars random verification code
$code = Crypto::generateKey(6);
// Register the verification code in the session
App::session()->setData('forgottenPassword', array('email' => $form->getData('email'), 'code' => Crypto::aes256Encode($code)));
$mail = new Mail();
$mail->from(Option::get($this->_plugin . '.mailer-from'), Option::get($this->_plugin . '.mailer-from-name'))->to($form->getData('email'))->subject(Lang::get($this->_plugin . '.reset-pwd-email-title', array('sitename' => Option::get($this->_plugin . '.sitename'))))->title(Lang::get('main.reset-pwd-email-title', array('sitename' => Option::get('main.sitename'))))->content(View::make(Plugin::current()->getView('reset-password-email.tpl'), array('sitename' => Option::get($this->_plugin . '.sitename'), 'code' => $code)))->send();
return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.forgotten-pwd-sent-email-message'));
} catch (\Exception $e) {
return $form->response(Form::STATUS_ERROR, DEBUG_MODE ? $e->getMessage() : Lang::get($this->_plugin . '.forgotten-pwd-form-error'));
}
}
}
}