当前位置: 首页>>代码示例>>PHP>>正文


PHP CMailFile::getValidAddress方法代码示例

本文整理汇总了PHP中CMailFile::getValidAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP CMailFile::getValidAddress方法的具体用法?PHP CMailFile::getValidAddress怎么用?PHP CMailFile::getValidAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMailFile的用法示例。


在下文中一共展示了CMailFile::getValidAddress方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Interfaces

     $object->elementtype = $object->element;
     // Appel des triggers
     include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
     $interface = new Interfaces($db);
     $result = $interface->run_triggers('COMPANY_SENTBYMAIL', $object, $user, $langs, $conf);
     if ($result < 0) {
         $error++;
         $this->errors = $interface->errors;
     }
     // Fin appel triggers
     if ($error) {
         dol_print_error($db);
     } else {
         // Redirect here
         // This avoid sending mail twice if going out and then back to page
         $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
         setEventMessage($mesg);
         header('Location: ' . $_SERVER["PHP_SELF"] . '?' . ($paramname ? $paramname : 'id') . '=' . $object->id);
         exit;
     }
 } else {
     $langs->load("other");
     $mesg = '<div class="error">';
     if ($mailfile->error) {
         $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
         $mesg .= '<br>' . $mailfile->error;
     } else {
         $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
     }
     $mesg .= '</div>';
     setEventMessage($mesg, 'warnings');
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:actions_sendmails.inc.php

示例2: CMailFile

                $filename = $attachedfiles['names'];
                $mimetype = $attachedfiles['mimes'];

                // Envoi de la propal
                require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
                $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
                if ($mailfile->error)
                {
                    $mesg='<div class="error">'.$mailfile->error.'</div>';
                }
                else
                {
                    $result=$mailfile->sendfile();
                    if ($result)
                    {
                        $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'.</div>';

                        $error=0;

                        // Initialisation donnees
                        $object->sendtoid		= $sendtoid;
                        $object->actiontypecode	= $actiontypecode;
                        $object->actionmsg 		= $actionmsg;
                        $object->actionmsg2		= $actionmsg2;
                        $object->fk_element		= $object->id;
						$object->elementtype		= $object->element;

                        // Appel des triggers
                        include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
                        $interface=new Interfaces($db);
                        $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$object,$user,$langs,$conf);
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例3: foreach

        if (!empty($object->bgimage)) {
            $arr_css['bgimage'] = $object->bgimage;
        }
        // Attached files
        $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
        if (count($listofpaths)) {
            foreach ($listofpaths as $key => $val) {
                $arr_file[] = $listofpaths[$key]['fullname'];
                $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
                $arr_name[] = $listofpaths[$key]['name'];
            }
        }
        $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css);
        $result = $mailfile->sendfile();
        if ($result) {
            $mesg = '<div class="ok">' . $langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)) . '</div>';
        } else {
            $mesg = '<div class="error">' . $langs->trans("ResultKo") . '<br>' . $mailfile->error . ' ' . $result . '</div>';
        }
        $action = '';
    }
}
// Action add emailing
if ($action == 'add') {
    $object->email_from = trim($_POST["from"]);
    $object->email_replyto = trim($_POST["replyto"]);
    $object->email_errorsto = trim($_POST["errorsto"]);
    $object->titre = trim($_POST["titre"]);
    $object->sujet = trim($_POST["sujet"]);
    $object->body = trim($_POST["body"]);
    $object->bgcolor = trim($_POST["bgcolor"]);
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:fiche.php

示例4: foreach

         if (!empty($object->bgimage)) {
             $arr_css['bgimage'] = $object->bgimage;
         }
         // Attached files
         $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
         if (count($listofpaths)) {
             foreach ($listofpaths as $key => $val) {
                 $arr_file[] = $listofpaths[$key]['fullname'];
                 $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
                 $arr_name[] = $listofpaths[$key]['name'];
             }
         }
         $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css);
         $result = $mailfile->sendfile();
         if ($result) {
             setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs');
         } else {
             setEventMessages($langs->trans("ResultKo") . '<br>' . $mailfile->error . ' ' . $result, null, 'errors');
         }
         $action = '';
     }
 }
 // Action add emailing
 if ($action == 'add') {
     $mesgs = array();
     $object->email_from = trim($_POST["from"]);
     $object->email_replyto = trim($_POST["replyto"]);
     $object->email_errorsto = trim($_POST["errorsto"]);
     $object->titre = trim($_POST["titre"]);
     $object->sujet = trim($_POST["sujet"]);
     $object->body = trim($_POST["body"]);
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:card.php

示例5: CMailFile

    if (!$error) {
        // Le message est-il en html
        $msgishtml = 0;
        // Message is not HTML
        if ($action == 'sendhtml') {
            $msgishtml = 1;
        }
        // Force message to HTML
        // Pratique les substitutions sur le sujet et message
        $subject = make_substitutions($subject, $substitutionarrayfortest);
        $body = make_substitutions($body, $substitutionarrayfortest);
        require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
        $mailfile = new CMailFile($subject, $sendto, $email_from, $body, $filepath, $mimetype, $filename, $sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml, $errors_to);
        $result = $mailfile->sendfile();
        if ($result) {
            setEventMessage($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($email_from, 2), $mailfile->getValidAddress($sendto, 2)));
        } else {
            setEventMessage($langs->trans("ResultKo") . '<br>' . $mailfile->error . ' ' . $result, 'errors');
        }
        $action = '';
    }
}
/*
 * View
 */
$linuxlike = 1;
if (preg_match('/^win/i', PHP_OS)) {
    $linuxlike = 0;
}
if (preg_match('/^mac/i', PHP_OS)) {
    $linuxlike = 0;
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:mails.php

示例6: array

 $substitutionarray = array('__ID__' => join(', ', array_keys($listofqualifiedinvoice)), '__EMAIL__' => $thirdparty->email, '__CHECK_READ__' => '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>', '__FACREF__' => join(', ', $listofqualifiedref), '__REF__' => join(', ', $listofqualifiedref), '__REFCLIENT__' => $thirdparty->name);
 $subject = make_substitutions($subject, $substitutionarray);
 $message = make_substitutions($message, $substitutionarray);
 $filepath = $attachedfiles['paths'];
 $filename = $attachedfiles['names'];
 $mimetype = $attachedfiles['mimes'];
 //var_dump($filepath);
 // Send mail
 require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
 $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
 if ($mailfile->error) {
     $resaction .= '<div class="error">' . $mailfile->error . '</div>';
 } else {
     $result = $mailfile->sendfile();
     if ($result) {
         $resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)) . '<br>';
         // Must not contain "
         $error = 0;
         // Insert logs into agenda
         foreach ($listofqualifiedinvoice as $invid => $object) {
             $actiontypecode = 'AC_FAC';
             $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
             if ($message) {
                 if ($sendtocc) {
                     $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
                 }
                 $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
                 $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
                 $actionmsg = dol_concatdesc($actionmsg, $message);
             }
             // Initialisation donnees
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:list.php

示例7: testCMailFileStatic

 /**
  * testCMailFileStatic
  *
  * @return string
  */
 public function testCMailFileStatic()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new CMailFile('', '', '', '');
     $src = 'John Doe <john@doe.com>';
     $result = $localobject->getValidAddress($src, 0);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertEquals($result, 'John Doe <john@doe.com>');
     $src = 'John Doe <john@doe.com>';
     $result = $localobject->getValidAddress($src, 1);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertEquals($result, '<john@doe.com>');
     $src = 'John Doe <john@doe.com>';
     $result = $localobject->getValidAddress($src, 2);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertEquals($result, 'john@doe.com');
     $src = 'John Doe <john@doe.com>';
     $result = $localobject->getValidAddress($src, 3, 0);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertEquals($result, '"John Doe" <john@doe.com>');
     $src = 'John Doe <john@doe.com>';
     $result = $localobject->getValidAddress($src, 3, 1);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertEquals($result, '"=?UTF-8?B?Sm9obiBEb2U=?=" <john@doe.com>');
     return $result;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:35,代码来源:CMailFileTest.php


注:本文中的CMailFile::getValidAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。