function invia_commento() { try { $nome = Params::get("nome"); $subject = Params::get("subject"); $email = Params::get("email"); $testo = Params::get("testo"); //$codice_hidden = Params::get("codice_hidden"); //$codice = Params::get("codice"); //if ($codice_hidden!=$codice) // throw new InvalidParameterException("Il codice non e' impostato correttamente!!"); if ($nome != null && $subject != null && $email != null && $testo != null && isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) { $e = new EMail("no_reply@" . Host::current_no_www(), Config::instance()->EMAIL_COMMENT_RECEIVED, "[Nuova commento da : " . $nome . "] - " . Host::current(), EMail::HTML_FORMAT); $e->render_and_send("include/messages/mail/alert/" . Lang::current() . "/nuovo_commento.php.inc", array("nome" => $nome, "email" => $email, "subject" => $subject, "testo" => $testo)); return Redirect::success(); } else { if (!isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) { throw new InvalidDataException("Il parametri di configurazione EMAIL_COMMENT_RECEIVED non e' impostato correttamente!!"); } else { throw new InvalidDataException("I dati immessi nella form non sono validi!!"); } } } catch (Exception $ex) { Flash::error($ex->getMessage()); return Redirect::failure(); } }
function send() { $success_message = Params::get("success_message"); $em = new EMail(Params::get("email"), Params::get("dest_address"), "Nuovo messaggio ricevuto", EMail::HTML_FORMAT); $vars = array("first_name" => Params::get("first_name"), "last_name" => Params::get("last_name"), "message" => Params::get("message")); $em->render_and_send("include/mail/message.php.inc", $vars); Flash::ok(Params::get($success_message)); return Redirect::success(); }
public function renderFile() { $aCurrentValues = $this->oFormStorage->saveCurrentValuesToSession(); $oFlash = Flash::getFlash(); $oFlash->setArrayToCheck($aCurrentValues); $bHasCaptcha = false; foreach ($this->oFormStorage->getFormObjects() as $oFormObject) { if ($oFormObject instanceof CaptchaObject) { $bHasCaptcha = true; } if ($oFormObject->shouldExcludeFromReport()) { continue; } if ($oFormObject->isRequired()) { $oFlash->checkForValue($oFormObject->getName()); } $oEmailItemTemplateInstance = clone $this->oEmailItemTemplate; $oEmailItemTemplateInstance->replaceIdentifier('name', $oFormObject->getName()); $oEmailItemTemplateInstance->replaceIdentifier('label', $oFormObject->getLabel()); $oEmailItemTemplateInstance->replaceIdentifier('value', $oFormObject->getCurrentValue()); $this->oEmailTemplate->replaceIdentifierMultiple('form_content', $oEmailItemTemplateInstance); } if ($bHasCaptcha && !FormFrontendModule::validateRecaptchaInput()) { $oFlash->addMessage('captcha_code_required'); } $oFlash->finishReporting(); if (Flash::noErrors()) { $oEmail = new EMail(TranslationPeer::getString('wns.form_module.email_subject', null, null, array('page' => $this->sPageName)), $this->oEmailTemplate); $oEmail->addRecipient($this->sEmailAddress); $oEmail->send(); $this->oFormStorage->deleteCurrentValuesFromSession(); LinkUtil::redirect($_REQUEST['origin'] . '?form_success=true'); } else { $oFlash->stick(); LinkUtil::redirect($_REQUEST['origin']); } }
public static function factory(Storage $storage, $row) { $email = new EMail($storage); $email->setEMailID($row["emailid"]); $email->setEMail($row["email"]); $email->setGPGFingerprint($row["gpgfingerprint"]); $email->setLastSend($row["lastSend"]); return $email; }
PLEASE READ CAREFULLY AND CHANGE VARIABLE BELOW. DISCLAIMER: THIS SCRIPT IS OFFERED AS IT IS WITHOUT ANY SUPPORT. USE OF SCRIPT IS SOLELY AT THE RISK OF USER. */ $smtp_user = "******"; // User name of smtp $smtp_pass = "******"; // Password of smtp user $to_address = "*****@*****.**"; // Set an email address where you wish to send all inform filled in form $from_address = "*****@*****.**"; // Set an email address from where the mail is coming to receiver // PLEASE DO NOT CHANGE ANYTHING BELOW THIS LINE IF YOU ARE NOT SURE WHAT YOU ARE DOING require "email.php"; $message = "Name: " . $_POST["name"] . "<br/> Area: " . $_POST["email"] . "<br/> Conatct No.: " . $_POST["conatct_no"] . "<br/> Message: " . $_POST["message"]; $mail = new EMail(); $mail->Username = $smtp_user; $mail->Password = $smtp_pass; $mail->SetFrom($from_address, "PuneLicAgents.com Contact Form"); // Name is optional // $mail->AddTo("*****@*****.**","Self"); // Name is optional $mail->AddTo($to_address); $mail->Subject = "Form Filled Details"; $mail->Message = $message; //Optional stuff // $mail->AddCc("*****@*****.**","name 3"); // Set a CC if needed, name optional $mail->ContentType = "text/html"; // Defaults to "text/plain; charset=iso-8859-1" $mail->Headers['X-SomeHeader'] = 'abcde'; // Set some extra headers if required $mail->ConnectTimeout = 30;
/** * E-mails a temporary password in response to a request from a user. * * This could be called from somewhere within the application that allows * someone to set up a user and invite them. * * This function includes EMail.php to actually send the password. */ function EmailTemporaryPassword($username, $email_address, $body_template = "") { global $c; $password_sent = false; $where = ""; $params = array(); if (isset($username) && $username != "") { $where = 'WHERE active AND lower(usr.username) = :lcusername'; $params[':lcusername'] = strtolower($username); } else { if (isset($email_address) && $email_address != "") { $where = 'WHERE active AND lower(usr.email) = :lcemail'; $params[':lcemail'] = strtolower($email_address); } } if ($where != '') { if (!isset($body_template) || $body_template == "") { $body_template = <<<EOTEXT @@debugging@@A temporary password has been requested for @@system_name@@. Temporary Password: @@password@@ This has been applied to the following usernames: @@usernames@@ and will be valid for 24 hours. If you have any problems, please contact the system administrator. EOTEXT; } $qry = new AwlQuery('SELECT * FROM usr ' . $where, $params); $qry->Exec('Session::EmailTemporaryPassword'); if ($qry->rows() > 0) { $q2 = new AwlQuery(); $q2->Begin(); while ($row = $qry->Fetch()) { $mail = new EMail("Access to {$c->system_name}"); $mail->SetFrom($c->admin_email); $usernames = ""; $debug_to = ""; if (isset($c->debug_email)) { $debug_to = "This e-mail would normally be sent to:\n "; $mail->AddTo("Tester <{$c->debug_email}>"); } $tmp_passwd = ''; for ($i = 0; $i < 8; $i++) { $tmp_passwd .= substr('ABCDEFGHIJKLMNOPQRSTUVWXYZ+#.-=*%@0123456789abcdefghijklmnopqrstuvwxyz', rand(0, 69), 1); } $q2->QDo('INSERT INTO tmp_password (user_no, password) VALUES(?,?)', array($row->user_no, $tmp_passwd)); if (isset($c->debug_email)) { $debug_to .= "{$row->fullname} <{$row->email}> "; } else { $mail->AddTo("{$row->fullname} <{$row->email}>"); } $usernames .= " {$row->username}\n"; if ($mail->To != "") { if (isset($c->debug_email)) { $debug_to .= "\n============================================================\n"; } $sql .= "COMMIT;"; $qry = new AwlQuery($sql); $qry->Exec("Session::SendTemporaryPassword"); $body = str_replace('@@system_name@@', $c->system_name, $body_template); $body = str_replace('@@password@@', $tmp_passwd, $body); $body = str_replace('@@usernames@@', $usernames, $body); $body = str_replace('@@debugging@@', $debug_to, $body); $mail->SetBody($body); $mail->Send(); $password_sent = true; } } } } return $password_sent; }
public static function AddToQueue(EMail $oEMail, $oLog) { $oNew = MetaModel::NewObject(__CLASS__); if ($oLog) { $oNew->Set('event_id', $oLog->GetKey()); } $oNew->Set('to', $oEMail->GetRecipientTO(true)); $oNew->Set('subject', $oEMail->GetSubject()); // $oNew->Set('version', 1); // $sMessage = serialize($oEMail); $oNew->Set('version', 2); $sMessage = $oEMail->SerializeV2(); $oNew->Set('message', $sMessage); $oNew->DBInsert(); }
public function searchEMail($address) { $sql = "SELECT `emailid`, `email`, `gpgfingerprint`, `lastSend` FROM `emails` WHERE `email` = '" . $this->escape($address) . "'"; $result = $this->getResult($sql, array($this, "parseEMail")); if ($result->getCount() > 0) { return $result->fetchRow(); } $email = new EMail($this); $email->setEMail($address); $email->setGPGFingerprint(null); $email->setLastSend(null); $email->save(); return $email; }
public function LoadConfig($sConfigFile = ITOP_DEFAULT_CONFIG_FILE) { if (is_null(self::$m_oConfig)) { self::$m_oConfig = new Config($sConfigFile); } }
case 'restore': $email = Filter::input('email', 'post', 'mail', true); if (!$email) { aExit(1, lng('INCOMPLETE_FORM')); } CaptchaCheck(2); $sql = "SELECT `{$bd_users['id']}` FROM `{$bd_names['users']}` " . "WHERE `{$bd_users['email']}`=:email"; $result = getDB()->fetchRow($sql, array('email' => $email), 'num'); if (!$result) { aExit(3, lng('RESTORE_NOT_EXIST')); } $restore_user = new User((int) $result[0]); $new_pass = randString(8); $subject = lng('RESTORE_TITLE'); $message = '<html><body><p>' . lng('RESTORE_TITLE') . '. ' . lng('RESTORE_NEW') . ' ' . lng('LOGIN') . ': ' . $restore_user->name() . '. ' . lng('PASS') . ': ' . $new_pass . '</p></body></html>'; if (!EMail::Send($email, $subject, $message)) { aExit(4, lng('MAIL_FAIL')); } if ($restore_user->changePassword($new_pass) != 1) { aExit(5, ''); } aExit(0, lng('RESTORE_COMPLETE')); break; case 'comment': $comment = Filter::input('comment'); $item_type = Filter::input('item_type', 'post', 'int'); $item_id = Filter::input('item_id', 'post', 'int'); CaptchaCheck(3); if (empty($user) or !$comment or !$item_type or !$item_id) { aExit(1, lng('MESS_FAIL')); }
/** sendNewsletter() * * @param mixed string/object recipient * @param object oEmailTemplateInstance * * @return void */ private function sendNewsletter($mRecipient, $oEmailTemplateInstance) { if (is_object($mRecipient)) { $oEmailTemplateInstance->replaceIdentifier('recipient', $mRecipient->getName()); if ($mRecipient instanceof Subscriber && $this->oUnsubscribePage) { $sLanguageId = FrontendManager::shouldIncludeLanguageInLink() ? $this->oNewsletter->getLanguageId() : false; if (method_exists($mRecipient, 'getUnsubscribeQueryParams')) { $sUnsubscribeLink = LinkUtil::absoluteLink(LinkUtil::link($this->oUnsubscribePage->getLink(), 'FrontendManager', $mRecipient->getUnsubscribeQueryParams(), $sLanguageId)); $oEmailTemplateInstance->replaceIdentifier('unsubscribe_link', $sUnsubscribeLink); } } } else { $oEmailTemplateInstance->replaceIdentifier('recipient', $mRecipient); } // Send newsletter and store invalid emails try { $sPlainTextMethod = Settings::getSetting('newsletter', 'plain_text_alternative_method', 'markdown'); $oEMail = null; if ($sPlainTextMethod === null || $sPlainTextMethod === false) { $oEMail = new EMail($this->oNewsletter->getSubject(), $oEmailTemplateInstance, true); } else { $oEMail = new EMail($this->oNewsletter->getSubject(), MIMEMultipart::alternativeMultipartForTemplate($oEmailTemplateInstance, null, null, $sPlainTextMethod), true); } if (is_object($mRecipient)) { $oEMail->addRecipient($mRecipient->getEmail(), $mRecipient->getName() === $mRecipient->getEmail() ? null : $mRecipient->getName()); } else { $oEMail->addRecipient($mRecipient); } $oEMail->setSender($this->sSenderName, $this->sSenderEmailAddress); $oEMail->send(); } catch (Exception $e) { $this->aInvalidEmails[] = new NewsletterSendFailure($e, $mRecipient); } }
public static function sendResetMail($oUser, $bShowUserName = false, $sLinkBase = null, $bForceReset = false) { UserPeer::ignoreRights(true); $oUser->setPasswordRecoverHint(PasswordHash::generateHint()); $oUser->save(); $oEmailTemplate = new Template('e_mail_pw_recover', array(DIRNAME_TEMPLATES, 'login')); $oEmailTemplate->replaceIdentifier('full_name', $oUser->getFullName()); $oEmailTemplate->replaceIdentifier('first_name', $oUser->getFirstName()); $oEmailTemplate->replaceIdentifier('last_name', $oUser->getLastName()); $oEmailTemplate->replaceIdentifier('username', $oUser->getUsername()); if ($bShowUserName) { $oEmailTemplate->replaceIdentifier('username_info', TranslationPeer::getString('wns.login.password_reset.your_username') . ': ' . $oUser->getUsername()); } $sInfoTextKey = 'wns.login.password_recover_email_text2'; if ($bForceReset) { $sInfoTextKey = 'wns.login.password_recover_email_text2_force'; } $oEmailTemplate->replaceIdentifier('ignore_or_reset_info', TranslationPeer::getString($sInfoTextKey)); if ($sLinkBase === null) { if (Manager::$CURRENT_MANAGER instanceof FrontendManager) { // We’re most likely on a login page: link to self should be ok $sLinkBase = LinkUtil::linkToSelf(null, null, true); } else { // Use the login manager $sLinkBase = LinkUtil::link(array(), 'LoginManager'); } } $aParams = array('recover_hint' => md5($oUser->getPasswordRecoverHint()), 'recover_username' => $oUser->getUsername()); if (Session::getSession()->hasAttribute('login_referrer')) { $aParams['recover_referrer'] = Session::getSession()->getAttribute('login_referrer'); } $sLink = "http://" . $_SERVER['HTTP_HOST'] . $sLinkBase . LinkUtil::prepareLinkParameters($aParams); $oEmailTemplate->replaceIdentifier('new_pw_url', $sLink); $oEmail = new EMail(TranslationPeer::getString('wns.login.password_recover_email_subject'), $oEmailTemplate); $sSenderAddress = LinkUtil::getDomainHolderEmail('cms'); $oEmail->setSender(Settings::getSetting('domain_holder', 'name', 'rapila on ' . $_SERVER['HTTP_HOST']), $sSenderAddress); $oEmail->addRecipient($oUser->getEmail(), $oUser->getFullName()); $oEmail->send(); }
public function changeEmail($email, $verification = false) { global $bd_users; $email = filter_var($email, FILTER_VALIDATE_EMAIL); if (!$email) { return 1901; } if ($email === $this->email) { if (!$verification) { return 1; } } else { $sql = "SELECT COUNT(*) FROM {$this->db} " . "WHERE `{$bd_users['email']}`=:email " . "AND `{$bd_users['id']}` != '{$this->id}'"; $line = getDB()->fetchRow($sql, array('email' => $email), 'num'); if ((int) $line[0]) { return 1902; } } if ($verification) { $subject = lng('REG_CONFIRM') . ' ' . $_SERVER['SERVER_NAME']; $http_link = 'http://' . $_SERVER['SERVER_NAME'] . BASE_URL . 'register.php?id=' . $this->id() . '&verificate=' . $this->getVerificationStr(); $message = '<html><body><p>' . lng('REG_CONFIRM_MES') . '. <a href="' . $http_link . '">' . lng('OPEN') . '</a></p></body></html>'; $send_result = EMail::Send($email, $subject, $message); if ($verification and !$send_result) { return 1903; } } if ($email != $this->email) { getDB()->ask("UPDATE {$this->db} " . "SET `{$bd_users['email']}`=:email " . "WHERE `{$bd_users['id']}`='{$this->id}'", array('email' => $email)); } $this->email = $email; return 1; }
/** * Send an iMIP message since they look like a non-local user. * * @param string $method The METHOD parameter from the iTIP * @param string $to_email The e-mail address we're going to send to * @param vCalendar $vcal The iTIP part of the message. */ function doImipMessage($method, $to_email, vCalendar $itip) { global $c, $request; header('Debug: Sending iMIP ' . $method . ' message to ' . $to_email); $mime = new MultiPart(); $mime->addPart($itip->Render(), 'text/calendar; charset=UTF-8; method=' . $method); $friendly_part = isset($c->iMIP->template[$method]) ? $c->iMIP->template[$method] : <<<EOTEMPLATE This is a meeting ##METHOD## which your e-mail program should be able to import into your calendar. Alternatively you could save the attachment and load that into your calendar instead. EOTEMPLATE; $components = $itip->GetComponents('VTIMEZONE', false); $replaceable = array('METHOD', 'DTSTART', 'DTEND', 'SUMMARY', 'DESCRIPTION', 'URL'); foreach ($replaceable as $pname) { $search = '##' . $pname . '##'; if (strstr($friendly_part, $search) !== false) { $property = $itip->GetProperty($pname); if (empty($property)) { $property = $components[0]->GetProperty($pname); } if (empty($property)) { $replace = ''; } else { switch ($pname) { case 'DTSTART': case 'DTEND': $when = new RepeatRuleDateTime($property); $replace = $when->format('c'); break; default: $replace = $property->GetValue(); } } $friendly_part = str_replace($search, $replace, $friendly_part); } } $mime->addPart($friendly_part, 'text/plain'); $email = new EMail(); $email->SetFrom($request->principal->email()); $email->AddTo($to_email); $email->SetSubject($components[0]->GetPValue('SUMMARY')); $email->SetBody($mime->getMimeParts()); if (isset($c->iMIP->pretend_email)) { $email->Pretend($mime->getMimeHeaders()); } else { if (!isset($c->iMIP->send_email) || !$c->iMIP->send_email) { $email->PretendLog($mime->getMimeHeaders()); } else { $email->Send($mime->getMimeHeaders()); } } }
private function handleNewJournalComment($oPage, $oEntry) { $oFlash = Flash::getFlash(); // Validate form and create new comment and $oComment = new JournalComment(); $oComment->setUsername($_POST['comment_name']); $oFlash->checkForValue('comment_name', 'comment_name_required'); $oComment->setEmail($_POST['comment_email']); $oFlash->checkForEmail('comment_email', 'comment_email_required'); if ($oEntry->getJournal()->getUseCaptcha() && !Session::getSession()->isAuthenticated() && !FormFrontendModule::validateRecaptchaInput() && !isset($_POST['preview'])) { $oFlash->addMessage('captcha_required'); } $oPurifierConfig = HTMLPurifier_Config::createDefault(); $oPurifierConfig->set('Cache.SerializerPath', MAIN_DIR . '/' . DIRNAME_GENERATED . '/' . DIRNAME_CACHES . '/purifier'); $oPurifierConfig->set('HTML.Doctype', 'XHTML 1.0 Transitional'); $oPurifierConfig->set('AutoFormat.AutoParagraph', true); $oPurifier = new HTMLPurifier($oPurifierConfig); $_POST['comment_text'] = $oPurifier->purify($_POST['comment_text']); $oComment->setText($_POST['comment_text']); $oFlash->checkForValue('comment_text', 'comment_required'); $oFlash->finishReporting(); if (isset($_POST['preview'])) { $oComment->setCreatedAt(date('c')); $_POST['preview'] = $oComment; } else { if (Flash::noErrors()) { $oEntry->addJournalComment($oComment); // Post is considered as spam $bIsProblablySpam = isset($_POST['important_note']) && $_POST['important_note'] != null; $sCommentNotificationTemplate = 'e_mail_comment_notified'; // Prevent publication if comments are not enabled or post is spam if (!$oEntry->getJournal()->getEnableComments() || $bIsProblablySpam) { if (!Session::getSession()->isAuthenticated()) { $oComment->setIsPublished(false); $sCommentNotificationTemplate = 'e_mail_comment_moderated'; } } $oComment->save(); // Notify new comment if ($oEntry->getJournal()->getNotifyComments()) { $oEmailContent = JournalPageTypeModule::templateConstruct($sCommentNotificationTemplate, $oPage->getPagePropertyValue('journal:template_set', 'default')); $oEmailContent->replaceIdentifier('email', $oComment->getEmail()); $oEmailContent->replaceIdentifier('user', $oComment->getUsername()); if ($bIsProblablySpam) { $oEmailContent->replaceIdentifier('this_comment_is_spam_note', TranslationPeer::getString('journal.this_comment_is_spam_note', null, null, array('important_note_content' => $_POST['important_note']))); } $oEmailContent->replaceIdentifier('comment', $oComment->getText()); $oEmailContent->replaceIdentifier('entry', $oEntry->getTitle()); $oEmailContent->replaceIdentifier('journal', $oEntry->getJournal()->getName()); $oEmailContent->replaceIdentifier('entry_link', LinkUtil::absoluteLink(LinkUtil::link($oEntry->getLink($oPage)))); $oEmailContent->replaceIdentifier('deactivation_link', LinkUtil::absoluteLink(LinkUtil::link(array('journal_comment_moderation', $oComment->getActivationHash(), 'deactivate'), 'FileManager'), null, LinkUtil::isSSL())); $oEmailContent->replaceIdentifier('activation_link', LinkUtil::absoluteLink(LinkUtil::link(array('journal_comment_moderation', $oComment->getActivationHash(), 'activate'), 'FileManager'), null, LinkUtil::isSSL())); $oEmailContent->replaceIdentifier('deletion_link', LinkUtil::absoluteLink(LinkUtil::link(array('journal_comment_moderation', $oComment->getActivationHash(), 'delete'), 'FileManager'), null, LinkUtil::isSSL())); $sSubject = TranslationPeer::getString('journal.notification_subject', null, null, array('entry' => $oEntry->getTitle())); $oEmail = new EMail($sSubject, $oEmailContent); $oSender = $oEntry->getUserRelatedByCreatedBy(); $oEmail->addRecipient($oSender->getEmail(), $oSender->getFullName()); $oEmail->send(); } $oSession = Session::getSession(); Flash::getFlash()->unfinishReporting()->addMessage('journal.has_new_comment', array(), "journal_entry.new_comment_thank_you" . ($oEntry->getJournal()->getEnableComments() || $oSession->isAuthenticated() ? '' : '.moderated'), 'new_comment_thank_you_message', 'p')->stick(); LinkUtil::redirect(LinkUtil::link($oEntry->getLink($oPage)) . "#comments"); } } }
protected function _DoExecute($oTrigger, $aContextArgs, &$oLog) { $sPreviousUrlMaker = ApplicationContext::SetUrlMakerClass(); try { $this->m_iRecipients = 0; $this->m_aMailErrors = array(); $bRes = false; // until we do succeed in sending the email // Determine recicipients // $sTo = $this->FindRecipients('to', $aContextArgs); $sCC = $this->FindRecipients('cc', $aContextArgs); $sBCC = $this->FindRecipients('bcc', $aContextArgs); $sFrom = MetaModel::ApplyParams($this->Get('from'), $aContextArgs); $sReplyTo = MetaModel::ApplyParams($this->Get('reply_to'), $aContextArgs); $sSubject = MetaModel::ApplyParams($this->Get('subject'), $aContextArgs); $sBody = MetaModel::ApplyParams($this->Get('body'), $aContextArgs); $oObj = $aContextArgs['this->object()']; $sMessageId = sprintf('iTop_%s_%d_%f@%s.openitop.org', get_class($oObj), $oObj->GetKey(), microtime(true), MetaModel::GetEnvironmentId()); $sReference = '<' . $sMessageId . '>'; } catch (Exception $e) { ApplicationContext::SetUrlMakerClass($sPreviousUrlMaker); throw $e; } ApplicationContext::SetUrlMakerClass($sPreviousUrlMaker); if (!is_null($oLog)) { // Note: we have to secure this because those values are calculated // inside the try statement, and we would like to keep track of as // many data as we could while some variables may still be undefined if (isset($sTo)) { $oLog->Set('to', $sTo); } if (isset($sCC)) { $oLog->Set('cc', $sCC); } if (isset($sBCC)) { $oLog->Set('bcc', $sBCC); } if (isset($sFrom)) { $oLog->Set('from', $sFrom); } if (isset($sSubject)) { $oLog->Set('subject', $sSubject); } if (isset($sBody)) { $oLog->Set('body', $sBody); } } $oEmail = new EMail(); if ($this->IsBeingTested()) { $oEmail->SetSubject('TEST[' . $sSubject . ']'); $sTestBody = $sBody; $sTestBody .= "<div style=\"border: dashed;\">\n"; $sTestBody .= "<h1>Testing email notification " . $this->GetHyperlink() . "</h1>\n"; $sTestBody .= "<p>The email should be sent with the following properties\n"; $sTestBody .= "<ul>\n"; $sTestBody .= "<li>TO: {$sTo}</li>\n"; $sTestBody .= "<li>CC: {$sCC}</li>\n"; $sTestBody .= "<li>BCC: {$sBCC}</li>\n"; $sTestBody .= "<li>From: {$sFrom}</li>\n"; $sTestBody .= "<li>Reply-To: {$sReplyTo}</li>\n"; $sTestBody .= "<li>References: {$sReference}</li>\n"; $sTestBody .= "</ul>\n"; $sTestBody .= "</p>\n"; $sTestBody .= "</div>\n"; $oEmail->SetBody($sTestBody); $oEmail->SetRecipientTO($this->Get('test_recipient')); $oEmail->SetRecipientFrom($this->Get('test_recipient')); $oEmail->SetReferences($sReference); $oEmail->SetMessageId($sMessageId); } else { $oEmail->SetSubject($sSubject); $oEmail->SetBody($sBody); $oEmail->SetRecipientTO($sTo); $oEmail->SetRecipientCC($sCC); $oEmail->SetRecipientBCC($sBCC); $oEmail->SetRecipientFrom($sFrom); $oEmail->SetRecipientReplyTo($sReplyTo); $oEmail->SetReferences($sReference); $oEmail->SetMessageId($sMessageId); } if (isset($aContextArgs['attachments'])) { $aAttachmentReport = array(); foreach ($aContextArgs['attachments'] as $oDocument) { $oEmail->AddAttachment($oDocument->GetData(), $oDocument->GetFileName(), $oDocument->GetMimeType()); $aAttachmentReport[] = array($oDocument->GetFileName(), $oDocument->GetMimeType(), strlen($oDocument->GetData())); } $oLog->Set('attachments', $aAttachmentReport); } if (empty($this->m_aMailErrors)) { if ($this->m_iRecipients == 0) { return 'No recipient'; } else { $iRes = $oEmail->Send($aErrors, false, $oLog); // allow asynchronous mode switch ($iRes) { case EMAIL_SEND_OK: return "Sent"; case EMAIL_SEND_PENDING: return "Pending"; case EMAIL_SEND_ERROR: return "Errors: " . implode(', ', $aErrors); } } } else { if (is_array($this->m_aMailErrors) && count($this->m_aMailErrors) > 0) { $sError = implode(', ', $this->m_aMailErrors); } else { $sError = 'Unknown reason'; } return 'Notification was not sent: ' . $sError; } }
/** * @param string $toEmail * @param string $subject * @param string $textPlain * @param string $textHtml * * @throws \Exception */ public static function sendWithLog($toEmail, $subject, $textPlain, $textHtml = '') { $mailer = new static(\Yii::$app->params); $messageId = explode('@', \Yii::$app->params['mailFromEmail']); $messageId = uniqid() . '@' . $messageId[1]; $exception = null; try { $message = $mailer->createMessage($subject, $textPlain, $textHtml, $messageId); $status = $mailer->send($message, $toEmail); } catch (\Exception $e) { $status = EMail::STATUS_DELIVERY_ERROR; $exception = $e; } $obj = new EMail(); $obj->toEmail = $toEmail; $obj->subject = $subject; $obj->text = $textPlain; $obj->dateSent = date('Y-m-d H:i:s'); $obj->status = $status; $obj->messageId = $messageId; $obj->save(); if ($exception) { /** @var \Exception $exception */ throw new \Exception($exception->getMessage()); } if (YII_ENV == 'test') { \Yii::$app->session->setFlash('email', 'E-Mail sent to: ' . $toEmail); } }
/** * sendMail() */ private function sendMail($oEmailTemplate, $bSendHtml = false) { $oEmailTemplate->replaceIdentifier('name', $this->oSubscriber->getName()); $sSenderName = Settings::getSetting('newsletter', 'sender_name', 'Rapila Newsletter Plugin'); $sSenderEmail = Settings::getSetting('newsletter', 'sender_email', LinkUtil::getDomainHolderEmail('no-reply')); $oEmailTemplate->replaceIdentifier('signature', $sSenderName); $oEmailTemplate->replaceIdentifier('weblink', LinkUtil::getHostName()); $oEmail = new EMail(TranslationPeer::getString('wns.subscriber_email.subject'), $oEmailTemplate, $bSendHtml); $oEmail->setSender($sSenderName, $sSenderEmail); $oEmail->addRecipient($this->oSubscriber->getEmail()); $oEmail->send(); }
$datax = _replace($data); $a = sendMail($mailto, $subject, $datax, $from, $cc, $bcc); } } } else { //Pear::Mail if ($_POST['mode'] == "bulk") { $email = new EMail(); $a = $email->sendMimeMessageAdvanced($to, $subject, $cc, $bcc, $data, $attach); } else { set_time_limit(0); $to = explode(",", $to); foreach ($to as $mailto) { updateUserEnv($mailto); $datax = _replace($data); $email = new EMail(); $a = $email->sendMimeMessageAdvanced($mailto, $subject, $cc, $bcc, $datax, $attach); } } } if ($a) { if (substr(strtolower($onsuccess), 0, 7) == "http://" || substr(strtolower($onsuccess), 0, 8) == "https://") { header("Location:{$onsuccess}"); } else { echo "<div width=100% align=center><p>{$onsuccess}</p></div>"; } } else { if (substr(strtolower($onerror), 0, 7) == "http://" || substr(strtolower($onerror), 0, 8) == "https://") { header("Location:{$onerror}"); } else { echo "<div width=100% align=center style='color:red'><p>{$onerror}</p></div>";
PLEASE READ CAREFULLY AND CHANGE VARIABLE BELOW. DISCLAIMER: THIS SCRIPT IS OFFERED AS IT IS WITHOUT ANY SUPPORT. USE OF SCRIPT IS SOLELY AT THE RISK OF USER. */ $smtp_user = "******"; // User name of smtp $smtp_pass = "******"; // Password of smtp user $to_address = "*****@*****.**"; // Set an email address where you wish to send all inform filled in form $from_address = "*****@*****.**"; // Set an email address from where the mail is coming to receiver // PLEASE DO NOT CHANGE ANYTHING BELOW THIS LINE IF YOU ARE NOT SURE WHAT YOU ARE DOING require "email-2.php"; $message = "Name: " . $_POST["name"] . "<br/> Address: " . $_POST["address"] . "<br/> Email: " . $_POST["email"] . "<br/> Contact No.: " . $_POST["conatct_no"] . "<br/> Education Qualification: " . $_POST["education"] . "<br/> Present Occupation: " . $_POST["education-2"] . "<br/> Message: " . $_POST["message"]; $mail = new EMail(); $mail->Username = $smtp_user; $mail->Password = $smtp_pass; $mail->SetFrom($from_address, "Contact Form"); // Name is optional // $mail->AddTo("*****@*****.**","Self"); // Name is optional $mail->AddTo($to_address); $mail->Subject = "Form Filled Details"; $mail->Message = $message; //Optional stuff // $mail->AddCc("*****@*****.**","name 3"); // Set a CC if needed, name optional $mail->ContentType = "text/html"; // Defaults to "text/plain; charset=iso-8859-1" $mail->Headers['X-SomeHeader'] = 'abcde'; // Set some extra headers if required $mail->ConnectTimeout = 30;
function email() { $email = Params::get("email"); if (EMail::is_valid($email)) { $peer = new AccountPeer(); $accounts = $peer->find_all_by_email($email); if (count($accounts) > 0) { return Result::error("La mail specificata (" . $email . ") è già in uso!! Utilizza un altro indirizzo email!!"); } return Result::ok(); } else { return Result::error("La mail inserita non è valida!!"); } }
public static function alert($app_name, $alert_title) { $e = new EMail("alert@" . Host::current(), "*****@*****.**", "[" . $app_name . "] - " . $alert_title, EMail::HTML_FORMAT); $e->render_and_send("framework/core/messages/alert/alert.php.inc", array("app_name" => $app_name, "alert_title" => $alert_title)); }
/** * @return boolean */ function Mail() { $form_name = $this->Config()->form_name(); $to_addr = $this->GetEnv('admin-mail'); $from_name = $this->Form()->GetInputValue($this->Config()->input_name('name'), $form_name); $from_addr = $this->Form()->GetInputValue($this->Config()->input_name('email'), $form_name); $subject = $this->Form()->GetInputValue($this->Config()->input_name('subject'), $form_name); $message = $this->Form()->GetInputValue($this->Config()->input_name('message'), $form_name); $mail = new EMail(); $mail->To($to_addr); $mail->Cc($from_addr, $from_name); $mail->From($from_addr, $from_name); $mail->Subject($subject); $mail->Content($message); if (!($io = $mail->Send())) { $mail->Debug(); } return $io; }
sqlConfigSet('email-mail', $email_mail); if ($config['smtp']) { $smtp_user = Filter::input('smtp_user'); $smtp_pass = Filter::input('smtp_pass'); $smtp_host = Filter::input('smtp_host'); $smtp_port = Filter::input('smtp_port', 'post', 'int'); $smtp_hello = Filter::input('smtp_hello'); sqlConfigSet('smtp-user', $smtp_user); if ($smtp_pass != '**defined**') { sqlConfigSet('smtp-pass', $smtp_pass); } sqlConfigSet('smtp-host', $smtp_host); sqlConfigSet('smtp-port', $smtp_port); sqlConfigSet('smtp-hello', $smtp_hello); } if ($email_test && !EMail::Send($email_test, 'Mail test', 'Content')) { $info .= '<br>' . lng('OPTIONS_MAIL_TEST_FAIL'); } } $theme_manager = new ThemeManager(false, 'index.php?mode=control&'); $theme_selector = $theme_manager->ShowThemeSelector(); include View::Get('constants.html', $st_subdir); break; case 'profile': if (!$ban_user) { break; } tokenTool('set'); $group_list = GroupManager::GetList($ban_user->group()); include View::Get('profile_main.html', $st_subdir . 'profile/'); $skin_def = $ban_user->defaultSkinTrigger();
/** * Send email to approvers. * * @return Response */ public function send($request_details, $approver_response) { $Mail = new EMail(); $Mail->sendMail($request_details, $approver_response, trim(Auth::user()->app_code)); return true; }