Exemplo n.º 1
0
 function avisar($asunto, $notif)
 {
     //MANDAR UN EMAIL A LOS INTERESADOS
     $mail = new mosPHPMailer();
     // defaults to using php "mail()"
     $mail->IsSMTP();
     // telling the class to use SMTP
     $mail->FromName = "Pedro II";
     $mail->From = "*****@*****.**";
     $mail->Username = "******";
     $mail->Password = "******";
     $mail->Port = 465;
     $mail->IsHTML(true);
     $mail->SMTPAuth = true;
     $mail->SMTPSecure = "ssl";
     $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
     // optional, comment out and test
     $mail->CharSet = "ISO-8859-1";
     //$mail->MsgHTML($body);
     $mail->ClearAllRecipients();
     $mail->Subject = $asunto;
     $body = $notif;
     $mail->Body = $body;
     $mail->Mailer = 'smtp';
     # destinatarios
     $mail->AddAddress('*****@*****.**');
     $mail->AddAddress('*****@*****.**');
     $ret5 = $mail->Send();
     if (!$ret5) {
         $errorMail = "Error al enviar email<br>" . $mail->ErrorInfo . '<br />' . $mail->Host . '<br />' . $mail->From . '<br />' . $mail->Username . '<br />' . $mail->Password . '<br />';
         echo $errorMail;
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 function getMailer($mailing, $html = 0)
 {
     global $_VERSION;
     $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false;
     $fromname = $mailing->fromname;
     $fromemail = trim($mailing->fromemail);
     $frombounce = empty($mailing->frombounce) ? trim($GLOBALS[ACA . 'confirm_return']) : trim($mailing->frombounce);
     $frombounceName = $fromname ? $fromname : $GLOBALS['mosConfig_fromname'];
     $attachments = $mailing->attachments;
     $images = $mailing->images;
     if (empty($fromemail)) {
         $fromemail = trim($GLOBALS['mosConfig_mailfrom']);
     }
     if (empty($fromname)) {
         $fromname = trim($GLOBALS['mosConfig_fromname']);
     }
     if ($joomAca15) {
         jimport('joomla.mail.mail');
         $phpmailerPath = JPATH_LIBRARIES . DS . 'phpmailer' . DS;
         //require_once(  $phpmailerPath . 'phpmailer.php' );
         $mail = new JMail();
     } else {
         $phpmailerPath = JPATH_ROOT . DS . 'includes' . DS . 'phpmailer' . DS;
         require_once $phpmailerPath . 'class.phpmailer.php';
         $mail = new mosPHPMailer();
         $mail->CharSet = substr_replace(_ISO, '', 0, 8);
     }
     $mail->PluginDir = $phpmailerPath;
     $mail->SetLanguage('en', $phpmailerPath . 'language' . DS);
     $mail->WordWrap = 150;
     //$mail->addCustomHeader("X-Mailer: ".$GLOBALS[ACA.'component'].$GLOBALS[ACA.'version']);
     $mail->addCustomHeader("X-Mailer: " . $GLOBALS['mosConfig_live_site']);
     $mail->addCustomHeader("X-MessageID: {$mailing->id}");
     if ($GLOBALS[ACA . 'mail_format'] == '1') {
         $mail->Encoding = 'base64';
     }
     if ($joomAca15) {
         $mail->addReplyTo(array($frombounce, $frombounceName));
     } else {
         $mail->AddReplyTo($frombounce, $frombounceName);
     }
     $mail->From = trim($fromemail);
     $mail->FromName = $fromname;
     $mail->Sender = trim($GLOBALS[ACA . 'sendmail_from']);
     if (empty($mail->Sender)) {
         $mail->Sender = trim($GLOBALS['mosConfig_mailfrom']);
     }
     switch ($GLOBALS[ACA . 'emailmethod']) {
         case 'mail':
             $mail->IsMail();
             break;
         case 'sendmail':
             $mail->IsSendmail();
             $mail->Sendmail = $GLOBALS[ACA . 'sendmail_path'] ? $GLOBALS[ACA . 'sendmail_path'] : $GLOBALS['mosConfig_sendmail'];
             break;
         case 'smtp':
             $mail->IsSMTP();
             $mail->Host = $GLOBALS[ACA . 'smtp_host'] ? $GLOBALS[ACA . 'smtp_host'] : $GLOBALS['mosConfig_smtphost'];
             if ((bool) $GLOBALS[ACA . 'smtp_auth_required']) {
                 $mail->SMTPAuth = $GLOBALS[ACA . 'smtp_auth_required'];
                 $mail->Password = $GLOBALS[ACA . 'smtp_password'];
                 $mail->Username = $GLOBALS[ACA . 'smtp_username'];
             }
             break;
         default:
             $mail->Mailer = $GLOBALS['mosConfig_mailer'];
             break;
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             if (basename($attachment) !== 'index.html') {
                 $mail->AddAttachment($GLOBALS['mosConfig_absolute_path'] . $GLOBALS[ACA . 'upload_url'] . DS . basename($attachment));
             }
         }
     }
     switch (substr(strtoupper(PHP_OS), 0, 3)) {
         case "WIN":
             $mail->LE = "\r\n";
             break;
         case "MAC":
         case "DAR":
             $mail->LE = "\r";
         default:
             break;
     }
     return $mail;
 }
Exemplo n.º 3
0
 function getMailer($mailing, $html = 0)
 {
     $fromname = $mailing->fromname;
     $fromemail = trim($mailing->fromemail);
     $frombounce = empty($mailing->frombounce) ? trim($GLOBALS[ACA . 'confirm_return']) : trim($mailing->frombounce);
     $attachments = $mailing->attachments;
     $images = $mailing->images;
     if (ACA_CMSTYPE) {
         // joomla 15
         $conf =& JFactory::getConfig();
         $frombounceName = $fromname ? $fromname : $conf->getValue('config.fromname');
         if (empty($fromemail)) {
             $fromemail = trim($conf->getValue('config.mailfrom'));
         }
         if (empty($fromname)) {
             $fromname = trim($conf->getValue('config.fromname'));
         }
     } else {
         //joomla 1x
         $frombounceName = $fromname ? $fromname : $GLOBALS['mosConfig_fromname'];
         if (empty($fromemail)) {
             $fromemail = trim($GLOBALS['mosConfig_mailfrom']);
         }
         if (empty($fromname)) {
             $fromname = trim($GLOBALS['mosConfig_fromname']);
         }
     }
     //endif
     if (ACA_CMSTYPE) {
         jimport('joomla.mail.mail');
         $phpmailerPath = JPATH_LIBRARIES . DS . 'phpmailer' . DS;
         //require_once(  $phpmailerPath . 'phpmailer.php' );
         $mail = new JMail();
     } else {
         $phpmailerPath = ACA_JPATH_ROOT_NO_ADMIN . DS . 'includes' . DS . 'phpmailer' . DS;
         require_once $phpmailerPath . 'class.phpmailer.php';
         $mail = new mosPHPMailer();
         $mail->CharSet = substr_replace(_ISO, '', 0, 8);
     }
     $mail->PluginDir = $phpmailerPath;
     $mail->SetLanguage('en', $phpmailerPath . 'language' . DS);
     $mail->WordWrap = 150;
     //$mail->addCustomHeader("X-Mailer: ".$GLOBALS[ACA.'component'].$GLOBALS[ACA.'version']);
     $mail->addCustomHeader("X-Mailer: " . ACA_JPATH_LIVE);
     $mail->addCustomHeader("X-MessageID: {$mailing->id}");
     if ($GLOBALS[ACA . 'mail_format'] == '1') {
         $mail->Encoding = 'base64';
     }
     if ($GLOBALS[ACA . 'minisendmail']) {
         $frombounceName = '';
     }
     if (ACA_CMSTYPE) {
         $mail->addReplyTo(array($frombounce, $frombounceName));
     } else {
         $mail->AddReplyTo($frombounce, $frombounceName);
     }
     $mail->From = trim($fromemail);
     if ($GLOBALS[ACA . 'minisendmail']) {
         $mail->FromName = '';
     } else {
         $mail->FromName = $fromname;
     }
     $mail->Sender = trim($GLOBALS[ACA . 'sendmail_from']);
     if (empty($mail->Sender)) {
         $mail->Sender = '';
     }
     switch ($GLOBALS[ACA . 'emailmethod']) {
         case 'mail':
             $mail->IsMail();
             break;
         case 'sendmail':
             $mail->IsSendmail();
             if (ACA_CMSTYPE) {
                 // joomla 15
                 $conf =& JFactory::getConfig();
                 $mail->Sendmail = $GLOBALS[ACA . 'sendmail_path'] ? $GLOBALS[ACA . 'sendmail_path'] : $conf->getValue('config.sendmail');
             } else {
                 //joomla 1x
                 $mail->Sendmail = $GLOBALS[ACA . 'sendmail_path'] ? $GLOBALS[ACA . 'sendmail_path'] : $GLOBALS['mosConfig_sendmail'];
             }
             //endif
             break;
         case 'smtp':
             $mail->IsSMTP();
             if (ACA_CMSTYPE) {
                 // joomla 15
                 $conf =& JFactory::getConfig();
                 $mail->Host = $GLOBALS[ACA . 'smtp_host'] ? $GLOBALS[ACA . 'smtp_host'] : $conf->getValue('config.smtphost');
             } else {
                 //joomla 1x
                 $mail->Host = $GLOBALS[ACA . 'smtp_host'] ? $GLOBALS[ACA . 'smtp_host'] : $GLOBALS['mosConfig_smtphost'];
             }
             //endif
             if ((bool) $GLOBALS[ACA . 'smtp_auth_required']) {
                 $mail->SMTPAuth = $GLOBALS[ACA . 'smtp_auth_required'];
                 $mail->Password = $GLOBALS[ACA . 'smtp_password'];
                 $mail->Username = $GLOBALS[ACA . 'smtp_username'];
             }
             break;
         default:
             if (ACA_CMSTYPE) {
                 // joomla 15
                 $conf =& JFactory::getConfig();
                 $mail->Mailer = $conf->getValue('config.mailer');
                 // $GLOBALS['mosConfig_mailer'];
             } else {
                 //joomla 1x
                 $mail->Mailer = $GLOBALS['mosConfig_mailer'];
             }
             //endif
             break;
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             if (basename($attachment) !== 'index.html') {
                 $mail->AddAttachment(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'upload_url'] . DS . basename($attachment));
             }
         }
     }
     switch (substr(strtoupper(PHP_OS), 0, 3)) {
         case "WIN":
             $mail->LE = "\r\n";
             break;
         case "MAC":
         case "DAR":
             $mail->LE = "\r";
         default:
             break;
     }
     return $mail;
 }
Exemplo n.º 4
0
$database = new database($mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix);
// load Joomla Language File
if (file_exists($mosConfig_absolute_path . '/language/' . $mosConfig_lang . '.php')) {
    require_once $mosConfig_absolute_path . '/language/' . $mosConfig_lang . '.php';
} else {
    require_once $mosConfig_absolute_path . '/language/english.php';
}
/*** END of Joomla config ***/
/*require_once( '../../../configuration.php' );

/*** VirtueMart part ***/
require_once $mosConfig_absolute_path . '/administrator/components/com_virtuemart/virtuemart.cfg.php';
require_once CLASSPATH . 'ps_main.php';
require_once CLASSPATH . "language.class.php";
require_once $mosConfig_absolute_path . '/includes/phpmailer/class.phpmailer.php';
$mail = new mosPHPMailer();
$mail->PluginDir = $mosConfig_absolute_path . '/includes/phpmailer/';
$mail->SetLanguage("en", $mosConfig_absolute_path . '/includes/phpmailer/language/');
/* load the VirtueMart Language File */
if (file_exists(ADMINPATH . 'languages/' . $mosConfig_lang . '.php')) {
    require_once ADMINPATH . 'languages/' . $mosConfig_lang . '.php';
} else {
    require_once ADMINPATH . 'languages/english.php';
}
/* Load the VirtueMart database class */
require_once CLASSPATH . 'ps_database.php';
/*** END VirtueMart part ***/
// Instantiate the DB class
$db = new ps_DB();
$default_vendor = 1;
$export_id = $database->getEscaped(vmGet($_REQUEST, 'method', ''));
Exemplo n.º 5
0
/**
* Function to create a mail object for futher use (uses phpMailer)
* @param string From e-mail address
* @param string From name
* @param string E-mail subject
* @param string Message body
* @return object Mail object
*/
function mosCreateMail($from = '', $fromname = '', $subject, $body)
{
    global $mosConfig_absolute_path, $mosConfig_sendmail;
    global $mosConfig_smtpauth, $mosConfig_smtpuser;
    global $mosConfig_smtppass, $mosConfig_smtphost;
    global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailer;
    $mail = new mosPHPMailer();
    $mail->PluginDir = $mosConfig_absolute_path . '/includes/phpmailer/';
    $mail->SetLanguage('en', $mosConfig_absolute_path . '/includes/phpmailer/language/');
    $mail->CharSet = substr_replace(_ISO, '', 0, 8);
    $mail->IsMail();
    $mail->From = $from ? $from : $mosConfig_mailfrom;
    $mail->FromName = $fromname ? $fromname : $mosConfig_fromname;
    $mail->Mailer = $mosConfig_mailer;
    // Add smtp values if needed
    if ($mosConfig_mailer == 'smtp') {
        $mail->SMTPAuth = $mosConfig_smtpauth;
        $mail->Username = $mosConfig_smtpuser;
        $mail->Password = $mosConfig_smtppass;
        $mail->Host = $mosConfig_smtphost;
    } else {
        // Set sendmail path
        if ($mosConfig_mailer == 'sendmail') {
            if (isset($mosConfig_sendmail)) {
                $mail->Sendmail = $mosConfig_sendmail;
            }
        }
    }
    // if
    $mail->Subject = $subject;
    $mail->Body = $body;
    return $mail;
}