本文整理汇总了PHP中Email类的典型用法代码示例。如果您正苦于以下问题:PHP Email类的具体用法?PHP Email怎么用?PHP Email使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Email类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: updateRequest
public function updateRequest($data)
{
$req = $this->find($data['id']);
if ($data['action'] == 'y') {
$ts3 = new TsAPI();
// send TS3 create request
$token = $ts3->createChan($req->cname);
if ($token) {
$req->reason = htmlspecialchars($data['msg']);
$req->status = 1;
$req->save();
if ($data['email']) {
$email = new Email();
$email->sendYes(array('req' => $req, 'token' => $token));
}
return 1;
}
} elseif ($data['action'] == 'n') {
$req->reason = htmlspecialchars($data['msg']);
$req->status = 2;
$req->save();
if ($data['email']) {
$email = new Email();
$email->sendNo(array('req' => $req));
}
return 2;
}
}
开发者ID:creativewild,项目名称:ts3Chan,代码行数:28,代码来源:Requests.php
示例2: onBeforeWrite
public function onBeforeWrite()
{
if ($this->owner->BaseClass == "Discussion" && $this->owner->ID == 0) {
$discussion = Discussion::get()->byID($this->owner->ParentID);
$discussion_author = $discussion->Author();
$holder = $discussion->Parent();
$author = Member::get()->byID($this->owner->AuthorID);
// Get our default email from address
if (DiscussionHolder::config()->send_emails_from) {
$from = DiscussionHolder::config()->send_email_from;
} else {
$from = Email::config()->admin_email;
}
// Vars for the emails
$vars = array("Title" => $discussion->Title, "Author" => $author, "Comment" => $this->owner->Comment, 'Link' => Controller::join_links($holder->Link("view"), $discussion->ID, "#comments-holder"));
// Send email to discussion owner
if ($discussion_author && $discussion_author->Email && $discussion_author->RecieveCommentEmails && $discussion_author->ID != $this->owner->AuthorID) {
$subject = _t("Discussions.NewCreatedReplySubject", "{Nickname} replied to your discussion", null, array("Nickname" => $author->Nickname));
$email = new Email($from, $discussion_author->Email, $subject);
$email->setTemplate('NewCreatedReplyEmail');
$email->populateTemplate($vars);
$email->send();
}
// Send to anyone who liked this, if they want notifications
foreach ($discussion->LikedBy() as $liked) {
if ($liked->RecieveLikedReplyEmails && $liked->Email && $liked->ID != $author->ID) {
$subject = _t("Discussions.NewLikedReplySubject", "{Nickname} replied to your liked discussion", null, array("Nickname" => $author->Nickname));
$email = new Email($from, $liked->Email, $subject);
$email->setTemplate('NewLikedReplyEmail');
$email->populateTemplate($vars);
$email->send();
}
}
}
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-discussions,代码行数:35,代码来源:DiscussionsComment.php
示例3: it_is_a_correct_object
/** @test */
public function it_is_a_correct_object()
{
$field = new Email('test', 'Test');
$this->assertSame('email', $field->getOption('type'));
$this->assertSame('administr/form::text', $field->getView());
$this->assertInstanceOf(AbstractType::class, $field);
}
开发者ID:administrcms,项目名称:form,代码行数:8,代码来源:EmailFieldTest.php
示例4: send_message
/**
* make sure to return TRUE as response if the message is sent
* successfully
* Sends a message from the current user to someone else in the networkd
* @param Int | String | Member $to -
* @param String $message - Message you are sending
* @param String $link - Link to send with message - NOT USED IN EMAIL
* @param Array - other variables that we include
* @return Boolean - return TRUE as success
*/
public static function send_message($to, $message, $link = "", $otherVariables = array())
{
//FROM
if (!empty($otherVariables["From"])) {
$from = $otherVariables["From"];
} else {
$from = Email::getAdminEmail();
}
//TO
if ($to instanceof Member) {
$to = $to->Email;
}
//SUBJECT
if (!empty($otherVariables["Subject"])) {
$subject = $otherVariables["Subject"];
} else {
$subject = substr($message, 0, 30);
}
//BODY
$body = $message;
//CC
if (!empty($otherVariables["CC"])) {
$cc = $otherVariables["CC"];
} else {
$cc = "";
}
//BCC
$bcc = Email::getAdminEmail();
//SEND EMAIL
$email = new Email($from, $to, $subject, $body, $bounceHandlerURL = null, $cc, $bcc);
return $email->send();
}
开发者ID:helpfulrobot,项目名称:sunnysideup-social-integration,代码行数:42,代码来源:EmailCallback.php
示例5: sendReminderMail
/**
* Sends a reminder mail to definined member groups.
*/
public function sendReminderMail()
{
// first check if required extension 'associategroups' is installed
if (!in_array('associategroups', $this->Config->getActiveModules())) {
$this->log('RscNewsletterReminder: Extension "associategroups" is required!', 'RscNewsletterReminder sendReminderMail()', TL_ERROR);
return false;
}
$this->loadLanguageFile("tl_settings");
if ($this->timeleadReached()) {
$objEmail = new \Email();
$objEmail->logFile = 'RscNewsletterReminderEmail.log';
$objEmail->from = $GLOBALS['TL_CONFIG']['rscNewsletterReminderEmailSenderAddress'];
$objEmail->fromName = strlen($GLOBALS['TL_CONFIG']['rscNewsletterReminderEmailSenderName']) > 0 ? $GLOBALS['TL_CONFIG']['rscNewsletterReminderEmailSenderName'] : $GLOBALS['TL_CONFIG']['websiteTitle'];
$objEmail->subject = $this->replaceEmailInsertTags($GLOBALS['TL_CONFIG']['rscNewsletterReminderEmailSubject']);
$objEmail->html = $this->replaceEmailInsertTags($GLOBALS['TL_CONFIG']['rscNewsletterReminderEmailContent']);
$objEmail->text = $this->transformEmailHtmlToText($objEmail->html);
try {
$objEmail->sendTo($this->getReceiverEmails());
$this->log('Monthly sending newsletter reminder finished successfully.', 'RscNewsletterReminder sendReminderMail()', TL_CRON);
return true;
} catch (Swift_RfcComplianceException $e) {
$this->log("Mail could not be send: " . $e->getMessage(), "RscNewsletterReminder sendReminderMail()", TL_ERROR);
return false;
}
}
return true;
}
开发者ID:rsclg,项目名称:RscNewsletterReminder,代码行数:30,代码来源:RscNewsletterReminder.php
示例6: cadastro
public function cadastro($created)
{
/**
* criar uma pessoa
*/
$modelPessoa = new Pessoa();
$pessoasId = $modelPessoa->genericInsert(array('tipo_pessoa' => 1, 'created' => $created));
/**
* criar uma pessoa fisica
*/
$ModelPF = new Fisica();
$ModelPF->genericInsert(array('pessoas_id' => $pessoasId, 'cpf' => '00000000000', 'nome' => $this->getNome()));
/**
* criar um contato
*/
$modelContato = new Contato();
$contatoId = $modelContato->genericInsert(array('telefone' => Utils::returnNumeric($this->getPhone()), 'tipo' => 1));
$modelContato->inserirContato($pessoasId, $contatoId);
/**
* criar um email
*/
$modelEmail = new Email();
$modelEmail->inserirEmailPessoa($pessoasId, $this->getEmail());
/**
* criar um usuario
*/
$modelUsuario = new Usuario();
$usuarioId = $modelUsuario->genericInsert(array('roles_id' => 1, 'pessoas_id' => $pessoasId, 'status' => 1, 'perfil_teste' => 0, 'created' => $created, 'email' => $this->getEmail(), 'login' => $this->getEmail(), 'senha' => Authentication::password($this->getPhone()), 'chave' => Authentication::uuid(), 'facebook_id' => $this->getFacebookId()));
$modelCliente = new Cliente();
$modelCliente->genericInsert(array('pessoas_id' => $pessoasId, 'status' => 1, 'sexo' => 0));
return $modelCliente->recuperaCliente($this->getNome(), $this->getPhone());
}
开发者ID:brunoblauzius,项目名称:sistema,代码行数:32,代码来源:Facebook.php
示例7: testEmailDomain
开发者ID:Attibee,项目名称:Bumble-Validation,代码行数:7,代码来源:EmailTest.php
示例8: saveEmailAddress
/**
* @param string $emailAddress
* @return mixed if true integer otherwise null
*/
public static function saveEmailAddress($emailAddress)
{
$emailID = null;
$parseEmail = explode('@', strtolower(trim($emailAddress)));
if (count($parseEmail) == 2) {
$domain = Domain::model()->findByAttributes(array('name' => $parseEmail[1]));
if (!$domain) {
$domain = new Domain();
$domain->name = $parseEmail[1];
}
if ($domain->save()) {
$email = new Email();
$email->username = $parseEmail[0];
$email->domainID = $domain->ID;
if ($email->save()) {
$emailID = $email->ID;
} else {
if ($domain->isNewRecord) {
Domain::model()->deleteByPk($domain->ID);
}
}
}
}
return $emailID;
}
开发者ID:andryluthfi,项目名称:annotation-tools,代码行数:29,代码来源:Util.php
示例9: sendEmail
public function sendEmail($emailbody, $time, $value, $options)
{
global $user, $session;
$timeformated = DateTime::createFromFormat("U", (int) $time);
$timeformated->setTimezone(new DateTimeZone($this->parentProcessModel->timezone));
$timeformated = $timeformated->format("Y-m-d H:i:s");
$tag = array("{id}", "{type}", "{time}", "{value}");
$replace = array($options['sourceid'], $options['sourcetype'], $timeformated, $value);
$emailbody = str_replace($tag, $replace, $emailbody);
if ($options['sourcetype'] == "INPUT") {
$inputdetails = $this->parentProcessModel->input->get_details($options['sourceid']);
$tag = array("{key}", "{name}", "{node}");
$replace = array($inputdetails['name'], $inputdetails['description'], $inputdetails['nodeid']);
$emailbody = str_replace($tag, $replace, $emailbody);
} else {
if ($options['sourcetype'] == "VIRTUALFEED") {
// Not suported for VIRTUAL FEEDS
}
}
$emailto = $user->get_email($session['userid']);
require_once "Lib/email.php";
$email = new Email();
//$email->from(from);
$email->to($emailto);
$email->subject('Emoncms event alert');
$email->body($emailbody);
$result = $email->send();
if (!$result['success']) {
$this->log->error("Email send returned error. message='" . $result['message'] . "'");
} else {
$this->log->info("Email sent to {$emailto}");
}
}
开发者ID:chaveiro,项目名称:emoncms,代码行数:33,代码来源:eventp_processlist.php
示例10: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Usuario();
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if (isset($_POST['Usuario'])) {
$model->attributes = $_POST['Usuario'];
$model->estatus_did = 1;
$model->tipoUsuario_did = 4;
$model->fechaCreacion_f = date("Y-d-m H:i:s");
$model->contrasena = md5($model->contrasena);
if (isset($_POST["noticias"])) {
$email = new Email();
$email->nombre = $model->nombre . " " . $model->apPaterno . " " . $model->apMaterno;
$email->direccion = $model->domCalle . " " . $model->domNo . " " . $model->domColonia;
$email->telefono = $model->telefono;
$email->correo = $model->correo;
$email->estatus_did = 1;
$email->fecha_f = date("Y-d-m");
$email->save();
}
if ($model->save()) {
$this->redirect(array('site/index'));
}
}
$this->render('create', array('model' => $model));
}
开发者ID:rzamarripa,项目名称:ase,代码行数:31,代码来源:UsuarioController.php
示例11: saveData
public function saveData()
{
$usuario['id'] = $_POST['id'];
$usuario['numero_identificacion'] = $usuario['username'] = $_POST['numero_identificacion'];
$usuario['nombres'] = $_POST['nombres'];
$usuario['apellidos'] = $_POST['apellidos'];
$usuario['genero'] = $_POST['genero'];
$usuario['tipo_usuario_id'] = $_POST['tipo_usuario_id'];
$usuario['capacidad_especial_id'] = $_POST['capacidad_especial_id'];
$usuario['password'] = $_POST['password'];
$usuario['email'] = $_POST['email'];
$usuario['estado_civil_id'] = $_POST['estado_civil_id'];
$mail = 0;
if ($usuario['id'] == 0) {
$usuario['activo'] = 0;
$mail = 1;
}
$model = new UsuarioModel();
try {
$datos = $model->saveUsuario($usuario);
$_SESSION['message'] = "Datos almacenados correctamente.";
if ($mail == 1) {
$token = base64_encode($usuario['numero_identificacion']);
$email = new Email();
$email->sendNotificacionRegistro($usuario['nombres'], $usuario['email'], $token);
}
} catch (Exception $e) {
$_SESSION['message'] = $e->getMessage();
}
header("Location: index.php");
}
开发者ID:efaby,项目名称:postulacion,代码行数:31,代码来源:UsuarioController.php
示例12: sendContactForm
public function sendContactForm($data, $form)
{
$email = new Email();
$email->setFrom('"mSupply Contact Form" <[email protected]>')->setTo($this->SiteConfig()->ContactFormEmail)->setSubject('mSupply Message')->setTemplate('ContactFormEmail')->populateTemplate(new ArrayData(array('FullName' => $data['FullName'], 'Phone' => $data['Phone'], 'Email' => $data['Email'], 'Message' => $data['Message'])));
$email->send();
return $this->redirectback();
}
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:7,代码来源:ContactPage.php
示例13: testFilter
function testFilter()
{
$email = new Email('[email protected]');
$this->assertFalse($email->getFilter());
$email = new FilterEmail('[email protected]');
$this->assertTrue($email->getFilter());
}
开发者ID:seliquity,项目名称:adamantium,代码行数:7,代码来源:Wrapper.test.php
示例14: addMessage
public static function addMessage($touser, $message)
{
$sql = '
INSERT INTO {{messages}}
SET
fromuser=' . $_SESSION['iuser']['id'] . ',
touser=' . $touser . ',
message=\'' . $message . '\',
cdate=NOW()
';
DB::exec($sql);
$sql = 'SELECT CONCAT(fname,\' \',lname) AS name, email FROM {{iusers}} WHERE id=' . $touser . '';
$row = DB::getRow($sql);
$toname = $row['name'];
$email = $row['email'];
if (trim($toname) == '') {
$toname = 'Неизвестный';
}
$text = '
Здравствуйте, ' . $toname . '!<br /><br />
' . $_SESSION['iuser']['name'] . ' написал Вам новое сообщение на сайте <a href="http://' . $_SERVER['HTTP_HOST'] . '">' . $_SERVER['HTTP_HOST'] . '</a>.<br /><br />
';
$text = View::getRenderEmpty('email/simple', array('text' => $text, 'title' => 'Новое сообщение'));
$mail = new Email();
$mail->To($email);
$mail->Subject('Новое сообщение от ' . $_SESSION['iuser']['name'] . ' на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
}
开发者ID:sov-20-07,项目名称:billing,代码行数:29,代码来源:MessageModel.php
示例15: send
/**
* Send mail
*
* @param \Cake\Network\Email\Email $email Cake Email
* @return array
*/
public function send(Email $email)
{
$headers = $email->getHeaders(['from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject']);
$headers = $this->_headersToString($headers);
$message = implode("\r\n", (array) $email->message());
return ['headers' => $headers, 'message' => $message];
}
开发者ID:yao-dev,项目名称:blog-mvc.github.io,代码行数:13,代码来源:DebugTransport.php
示例16: forgot
function forgot()
{
if ($_POST) {
DB::escapePost();
$sql = '
SELECT * FROM {{users}} WHERE login=\'' . $_POST['login'] . '\'
';
$return = DB::getRow($sql);
if ($return) {
$pass = Funcs::generate_password(8);
$sql = '
UPDATE {{users}}
SET pass=MD5(\'' . $pass . '\')
WHERE login=\'' . $_POST['login'] . '\'
';
DB::exec($sql);
$text = '
Здравствуйте, ' . $return["login"] . '.<br />
Ваш новый пароль ' . $pass . '.<br />
Сменить пароль Вы можете в личном кабинете.
';
$mail = new Email();
$mail->To($return['email']);
$mail->Subject('Восстановление пароля на сайте www.' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
$mail->Text($text);
$mail->Send();
}
$this->redirect('/');
} else {
View::$layout = 'empty';
View::render('site/forgot');
}
}
开发者ID:sov-20-07,项目名称:billing,代码行数:33,代码来源:LoginController.php
示例17: handle_file_upload
/**
* Override the default method to handle the specific things of the download module and
* update the database after file was successful uploaded.
* This method has the same parameters as the default.
* @param $uploaded_file
* @param $name
* @param $size
* @param $type
* @param $error
* @param $index
* @param $content_range
* @return stdClass
*/
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
{
global $gPreferences, $gL10n, $gDb, $getId, $gCurrentOrganization, $gCurrentUser;
$file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
if (!isset($file->error)) {
try {
// check filesize against module settings
if ($file->size > $gPreferences['max_file_upload_size'] * 1024 * 1024) {
throw new AdmException('DOW_FILE_TO_LARGE', $gPreferences['max_file_upload_size']);
}
// check filename and throw exception if something is wrong
admStrIsValidFileName($file->name, true);
// get recordset of current folder from database and throw exception if necessary
$targetFolder = new TableFolder($gDb);
$targetFolder->getFolderForDownload($getId);
// now add new file to database
$newFile = new TableFile($gDb);
$newFile->setValue('fil_fol_id', $targetFolder->getValue('fol_id'));
$newFile->setValue('fil_name', $file->name);
$newFile->setValue('fil_locked', $targetFolder->getValue('fol_locked'));
$newFile->setValue('fil_counter', '0');
$newFile->save();
// Benachrichtigungs-Email für neue Einträge
$message = $gL10n->get('DOW_EMAIL_NOTIFICATION_MESSAGE', $gCurrentOrganization->getValue('org_longname'), $file->name, $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), date($gPreferences['system_date'], time()));
$notification = new Email();
$notification->adminNotfication($gL10n->get('DOW_EMAIL_NOTIFICATION_TITLE'), $message, $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), $gCurrentUser->getValue('EMAIL'));
} catch (AdmException $e) {
$file->error = $e->getText();
unlink($this->options['upload_dir'] . $file->name);
return $file;
}
}
return $file;
}
开发者ID:martinbrylski,项目名称:admidio,代码行数:47,代码来源:uploadhandlerdownload.php
示例18: sendReport
/**
* Sends a report of the parsing and social update.
* @param $to [string] e-mail address to send the report to
* @param $errors [array] list of errors
* @param $notices [array] list of notices
* @todo Make template based (plain text and/or HTML using Mailer::setHtml()).
* @todo This function should probably be in the SocialUpdate class, as well as the error/notice handling.
*/
function sendReport($to, &$errors, &$notices)
{
if (!$to) {
return;
}
$errorCount = count($errors);
$from = Config::$siteName . " <no-reply@" . $_SERVER['SERVER_NAME'] . ">";
$subject = $errorCount ? "Update error" : "Update successful";
if ($errorCount) {
$msg = "Your update was not processed because of the following error(s):\n\n";
foreach ($errors as $error) {
$msg .= "- {$error}\n\n";
}
} else {
if (count($notices)) {
$msg = "Your update was successful:\n\n";
foreach ($notices as $notice) {
$msg .= "- {$notice}\n\n";
}
} else {
$msg = "Your update was successful.";
}
}
$email = new Email($from, $to, $subject);
$email->setPlain($msg);
$email->send();
}
开发者ID:robkaper,项目名称:kiki,代码行数:35,代码来源:email-importer.php
示例19: SendNewsletterForm
public function SendNewsletterForm($data, $form)
{
$email = new Email();
$email->setFrom('"mSupply Newsletter Form" <[email protected]>')->setTo($this->SiteConfig()->NewsletterFormEmail)->setSubject('mSupply Newsletter Request')->setTemplate('NewsletterSignUpEmail')->populateTemplate(new ArrayData(array('Email' => $data['Email'])));
$email->send();
return $this->redirectback();
}
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:7,代码来源:Page.php
示例20: createEmail
public static function createEmail($id = '', $override = array())
{
global $timedate;
$time = mt_rand();
$name = 'SugarEmail';
$email = new Email();
$email->name = $name . $time;
$email->type = 'out';
$email->status = 'sent';
$email->date_sent = $timedate->to_display_date_time(gmdate("Y-m-d H:i:s", gmmktime() - 3600 * 24 * 2));
// Two days ago
if (!empty($id)) {
$email->new_with_id = true;
$email->id = $id;
}
foreach ($override as $key => $value) {
$email->{$key} = $value;
}
$email->save();
if (!empty($override['parent_id']) && !empty($override['parent_type'])) {
self::createEmailsBeansRelationship($email->id, $override['parent_type'], $override['parent_id']);
}
self::$_createdEmails[] = $email;
return $email;
}
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:25,代码来源:SugarTestEmailUtilities.php
注:本文中的Email类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论