Beispiel #1
0
 function commit_save()
 {
     if (!$this->_form->validate()) {
         $this->_display->add($this->form);
         return false;
     }
     $message_data = $this->_form->getValues();
     if ($sender_name = $message_data['sender_name']) {
         unset($message_data['sender_name']);
     }
     $target = $this->make_address($message_data, 'recipient');
     $sender = $this->make_address($message_data, 'sender');
     if (!($target && $sender)) {
         return false;
     }
     require_once 'AMP/System/Email.inc.php';
     $emailer = new AMPSystem_Email();
     $emailer->setTarget($target);
     $emailer->setSender($sender);
     if ($sender_name) {
         $emailer->setSenderName($sender_name);
     }
     $emailer->setSubject($message_data['subject']);
     $emailer->setMessage($message_data['message']);
     $result = $emailer->execute();
     if ($result) {
         $this->save_message_record($message_data);
         $message = new AMP_Content_Buffer();
         $message->add("<center>Message successfully sent!<br>Thank you!<br><br>[ <a href=\"javascript:window.close();\" onclick='window.close( );'>Close this window</a> ]</center>");
         $this->_display->add($message);
     }
     return $result;
 }
Beispiel #2
0
 function execute($options = null)
 {
     // Allow for pre-processing of message & options. Return anything but
     // true to abort message send.
     if (method_exists($this, 'preProcess')) {
         $rt = $this->preProcess();
         if ($rt !== true) {
             return $rt;
         }
     }
     //get options
     $options = array_merge($this->getOptions(), $options);
     //invoke system email
     require_once 'AMP/System/Email.inc.php';
     $emailer = new AMPSystem_Email();
     $this->emailer = $emailer;
     // Header text.
     //This sucks.  why can't i just call udm->getData???
     $merge = false;
     if (isset($options['merge_fields']) && $options['merge_fields']) {
         $constructor = $this->udm->getPlugin('QuickForm', 'Build');
         #$constructor->execute();
         $merge = $constructor->_formEngine->getValues();
         $real_merge = array();
         foreach ($merge as $field_name => $value) {
             if (!is_array($value)) {
                 $real_merge[$field_name] = $value;
             }
         }
         $merge = $real_merge;
     }
     $this->message .= $this->_getBodyHeader($options, $merge);
     $this->message .= $this->prepareMessage($options);
     // Footer Text.
     $this->message .= $this->_getBodyFooter($options, $merge);
     if ($this->containsHTML()) {
         $this->message = nl2br($this->message);
     }
     // Construct the header.
     $this->header = $this->prepareHeader($options);
     // Allow for post-processing. Returrn anything but true to abort
     // message send.
     if (method_exists($this, 'postProcess')) {
         $rt = $this->postProcess();
         if ($rt !== true) {
             return $rt;
         }
     }
     $email_target = $this->getEmailTarget($options);
     if (!$email_target) {
         return false;
     }
     // Send the mail.
     $emailer->setTarget($email_target);
     $emailer->setSubject($options['subject']);
     $emailer->setMessage($this->message);
     return $emailer->execute();
     #return mail( $options['mailto'], $options['subject'], $this->message, $this->header );
 }
 function execute($options)
 {
     $emailer = new AMPSystem_Email();
     $emailer->setTarget($this->target);
     $emailer->setSubject($this->subject);
     $emailer->setMessage(sprintf($this->message, $options['article_url'], $options['comment_status'], $options['comment_edit_url']));
     $emailer->execute();
 }
Beispiel #4
0
 function send_password_reset($account)
 {
     $email = new AMPSystem_Email();
     $email->setSubject("Reset password for " . AMP_SITE_NAME);
     $email->setRecipient($account->getData('Email'));
     $email->setMessage($this->password_reset_message($account));
     return $email->execute();
 }
Beispiel #5
0
 function save($data, $options = array())
 {
     $options = array_merge($this->getOptions(), $options);
     if ($this->_admin) {
         return true;
     }
     $message = 'subscribe ' . $options['list_name'];
     $emailer = new AMPSystem_Email();
     $emailer->setSender($data['Email']);
     $emailer->setMessage($message);
     $emailer->setRecipient($options['subscribe_address']);
     $emailer->setSubject($message);
     $emailer->execute();
     return true;
 }
Beispiel #6
0
 function save($data)
 {
     $options = $this->getOptions();
     if (!isset($this->udm->uid)) {
         $this->udm->errorMessage("Invalid Contact Info");
         return false;
     }
     if (!(isset($data['action_id']) && $data['action_id'])) {
         $this->udm->errorMessage("No Appointment Selected");
         return;
     }
     $schedule = new Schedule($this->dbcon, $options['schedule_id']);
     if (!$schedule->makeAppointment($this->udm->uid, $data['action_id'])) {
         $this->udm->errorMessage("The requested schedule time is not avaiable");
         return false;
     }
     $item =& $schedule->getScheduleItem($data['action_id']);
     $appt_contact_data = $this->udm->getData();
     $recipients = array();
     if (isset($options['email_contact_schedule']) && $options['email_contact_schedule']) {
         $recipients['schedule'] = $item->getOwnerEmail();
     }
     if (isset($options['email_contact_appointment']) && $options['email_contact_appointment']) {
         $recipients['appointment'] = $appt_contact_data['Email'];
     }
     if (empty($recipients)) {
         return true;
     }
     $item_data = $item->getData();
     $item_data['schedule_contact_name'] = $item->getOwnerName();
     $item_data['schedule_contact_email'] = $item->getOwnerEmail();
     $item_data['schedule_start_time_text'] = $item->getTimeText();
     $item_data = array_merge($item_data, $this->getAppointmentContactData());
     foreach ($recipients as $which_contact => $email) {
         $text_id = $options['email_contact_' . $which_contact];
         $text = new AMPSystem_IntroText($this->dbcon, $text_id);
         $sch_email = new AMPSystem_Email();
         $sch_email->setSubject($text->getTitle());
         $sch_email->setRecipient($email);
         $sch_email->setMessage($text->mergeBodyFields($item_data));
         if (!$sch_email->execute()) {
             trigger_error(sprintf(AMP_ERROR_SCHEDULE_APPOINTMENT_EMAIL_NOT_SENT, $email));
         }
     }
     return true;
 }
Beispiel #7
0
 function sendOtp($email_address, $uid)
 {
     $secret = $this->_handler->get_seed();
     $hash = $this->_handler->make_secure_cookie($email_address, $this->_default_permission, $secret);
     $this->_handler->save_session($hash, $secret);
     require_once 'AMP/System/Email.inc.php';
     $emailMessage = new AMPSystem_Email();
     $emailMessage->setRecipient($email_address);
     $emailMessage->setSubject(AMP_SITE_NAME . ' Password ' . ucfirst($this->_current_action));
     $emailMessage->setMessage('Passcode: ' . $hash . "\n or login here: " . AMP_SITE_URL . substr($this->getLoginUrl(array('uid=' . $uid, 'otp=' . $hash)), 1));
     return $emailMessage->execute();
 }
Beispiel #8
0
$form->Build();
$form->enforceRules();
$showForm = !($form->submitted() && $form->validate());
$intro_id = $showForm ? AMP_CONTENT_PUBLICPAGE_ID_CONTACT_US : AMP_CONTENT_PUBLICPAGE_ID_CONTACT_US_RESPONSE;
$modid = AMP_MODULE_ID_CONTACT_US;
require_once "AMP/BaseTemplate.php";
$flash =& AMP_System_Flash::instance();
print $flash->execute();
require_once "AMP/BaseModuleIntro.php";
if (!isset($MM_email_contact)) {
    $MM_email_contact = false;
}
if (!defined('AMP_SITE_EMAIL_CONTACT')) {
    define('AMP_SITE_EMAIL_CONTACT', $MM_email_contact);
}
if ($showForm) {
    print $form->output();
} elseif (AMP_SITE_EMAIL_CONTACT) {
    $data = $form->getValues();
    require_once 'AMP/System/Email.inc.php';
    $email_maker = new AMPSystem_Email();
    $email_maker->setRecipient(AMP_SITE_EMAIL_CONTACT);
    $email_maker->setMessage($data['message']);
    $email_maker->setSender($data['sender_email']);
    $email_maker->setSenderName(false);
    $email_maker->setSubject($data['subject']);
    $email_maker->execute();
} else {
    print AMP_TEXT_ERROR_TOOL_NOT_CONFIGURED;
}
require_once "AMP/BaseFooter.php";