本文整理汇总了PHP中ilMail::setSaveInSentbox方法的典型用法代码示例。如果您正苦于以下问题:PHP ilMail::setSaveInSentbox方法的具体用法?PHP ilMail::setSaveInSentbox怎么用?PHP ilMail::setSaveInSentbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilMail
的用法示例。
在下文中一共展示了ilMail::setSaveInSentbox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: distributeMails
/**
* mail via soap
* @param object $sid
* @param object $a_mail_xml
* @return
*/
public function distributeMails($sid, $a_mail_xml)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
include_once 'Services/Mail/classes/class.ilMail.php';
include_once 'webservice/soap/classes/class.ilSoapMailXmlParser.php';
$parser = new ilSoapMailXmlParser($a_mail_xml);
try {
// Check if wellformed
libxml_use_internal_errors(true);
$ok = simplexml_load_string($a_mail_xml);
if (!$ok) {
foreach (libxml_get_errors() as $err) {
$error .= $err->message . ' ';
}
return $this->__raiseError($error, 'CLIENT');
}
$parser->start();
} catch (InvalidArgumentException $e) {
$GLOBALS['ilLog']->write(__METHOD__ . ' ' . $e->getMessage());
return $this->__raiseError($e->getMessage(), 'CLIENT');
} catch (ilSaxParserException $e) {
$GLOBALS['ilLog']->write(__METHOD__ . ' ' . $e->getMessage());
return $this->__raiseError($e->getMessage(), 'CLIENT');
}
$mails = $parser->getMails();
global $ilUser;
foreach ($mails as $mail) {
// Prepare attachments
include_once './Services/Mail/classes/class.ilFileDataMail.php';
$file = new ilFileDataMail($ilUser->getId());
foreach ((array) $mail['attachments'] as $attachment) {
// TODO: Error handling
$file->storeAsAttachment($attachment['name'], $attachment['content']);
$attachments[] = ilUtil::_sanitizeFilemame($attachment['name']);
}
$mail_obj = new ilMail($ilUser->getId());
$mail_obj->setSaveInSentbox(true);
$mail_obj->saveAttachments((array) $attachments);
$mail_obj->sendMail(implode(',', (array) $mail['to']), implode(',', (array) $mail['cc']), implode(',', (array) $mail['bcc']), $mail['subject'], implode("\n", $mail['body']), (array) $attachments, array($mail['type']), (bool) $mail['usePlaceholders']);
// Finally unlink attachments
foreach ((array) $attachments as $att) {
$file->unlinkFile($att);
}
$mail_obj->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
}
return true;
}