本文整理汇总了PHP中Gdn_Email::From方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Email::From方法的具体用法?PHP Gdn_Email::From怎么用?PHP Gdn_Email::From使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Email
的用法示例。
在下文中一共展示了Gdn_Email::From方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendEmailMessage
/**
* Send email message.
*/
function SendEmailMessage($Recipient, $Subject, $Message, $Options = False)
{
$MimeType = ArrayValue('MimeType', $Options, 'text/plain');
$SenderEmail = ArrayValue('SenderEmail', $Options, '');
$SenderName = ArrayValue('SenderName', $Options, '');
$Email = new Gdn_Email();
$Result = $Email->From($SenderEmail, $SenderName)->MimeType($MimeType)->Subject($Subject)->To($Recipient)->Message($Message)->Send();
return $Result;
}
示例2: PasswordRequest
public function PasswordRequest($Email)
{
$User = $this->GetWhere(array('Email' => $Email))->FirstRow();
if (!is_object($User) || $Email == '') {
return FALSE;
}
$PasswordResetKey = RandomString(6);
$this->SaveAttribute($User->UserID, 'PasswordResetKey', $PasswordResetKey);
$AppTitle = Gdn::Config('Garden.Title');
$Email = new Gdn_Email();
$Email->Subject(sprintf(Gdn::Translate('[%s] Password Reset Request'), $AppTitle));
$Email->To($User->Email);
$Email->From(Gdn::Config('Garden.Support.Email'), Gdn::Config('Garden.Support.Name'));
$Email->Message(sprintf(Gdn::Translate('PasswordRequest'), $User->Name, $AppTitle, Url('/entry/passwordreset/' . $User->UserID . '/' . $PasswordResetKey, TRUE)));
$Email->Send();
return TRUE;
}
示例3: Send
public function Send($InvitationID)
{
$Invitation = $this->GetByInvitationID($InvitationID);
$Session = Gdn::Session();
if ($Invitation === FALSE) {
throw new Exception(T('ErrorRecordNotFound'));
} else {
if ($Session->UserID != $Invitation->SenderUserID) {
throw new Exception(T('ErrorPermission'));
} else {
// Some information for the email
$RegistrationUrl = CombinePaths(array(Gdn::Request()->WebPath(TRUE, FALSE), 'entry', 'register', $Invitation->Code), '/');
$AppTitle = Gdn::Config('Garden.Title');
$Email = new Gdn_Email();
$Email->Subject(sprintf(T('[%s] Invitation'), $AppTitle));
$Email->To($Invitation->Email);
$Email->From($Invitation->SenderEmail, $Invitation->SenderName);
$Email->Message(sprintf(T('EmailInvitation'), $Invitation->SenderName, $AppTitle, $RegistrationUrl));
$Email->Send();
}
}
}
示例4: SendNotification
public function SendNotification($ActivityID, $Story = '')
{
$Activity = $this->GetID($ActivityID);
if (!is_object($Activity)) {
return;
}
$Story = Format::Text($Story == '' ? $Activity->Story : $Story);
// If this is a comment on another activity, fudge the activity a bit so that everything appears properly.
if (is_null($Activity->RegardingUserID) && $Activity->CommentActivityID > 0) {
$CommentActivity = $this->GetID($Activity->CommentActivityID);
$Activity->RegardingUserID = $CommentActivity->RegardingUserID;
$Activity->Route = '/profile/' . $CommentActivity->RegardingUserID . '/' . Format::Url($CommentActivity->RegardingName) . '/#Activity_' . $Activity->CommentActivityID;
}
$User = $this->SQL->Select('Name, Email, Preferences')->From('User')->Where('UserID', $Activity->RegardingUserID)->Get()->FirstRow();
if ($User) {
$Preferences = Format::Unserialize($User->Preferences);
$Preference = ArrayValue('Email.' . $Activity->ActivityType, $Preferences, Gdn::Config('Preferences.Email.' . $Activity->ActivityType));
if ($Preference) {
$ActivityHeadline = Format::Text(Format::ActivityHeadline($Activity, $Activity->ActivityUserID, $Activity->RegardingUserID));
$Email = new Gdn_Email();
$Email->Subject(sprintf(T('[%1$s] %2$s'), Gdn::Config('Garden.Title'), $ActivityHeadline));
$Email->To($User->Email, $User->Name);
$Email->From(Gdn::Config('Garden.SupportEmail'), Gdn::Config('Garden.SupportName'));
$Email->Message(sprintf(T($Story == '' ? 'EmailNotification' : 'EmailStoryNotification'), $ActivityHeadline, Url($Activity->Route == '' ? '/' : $Activity->Route, TRUE), $Story));
try {
$Email->Send();
} catch (Exception $ex) {
// Don't do anything with the exception.
}
}
}
}