本文整理汇总了PHP中Mail::setContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::setContent方法的具体用法?PHP Mail::setContent怎么用?PHP Mail::setContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::setContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMailMessage
/**
* send email
*/
function sendMailMessage($title, $message, $recipientName, $recipientEmailAddress, $senderName, $senderEmailAddress)
{
$oMail = new Mail();
$oMail->setTitle($title);
$oMail->setContent($message);
$oMail->setSender($senderName, $senderEmailAddress);
$oMail->setReceiptor($recipientName, $recipientEmailAddress);
$oMail->send();
}
示例2: procCommunicationSendMessage
/**
* @brief 쪽지 발송
**/
function procCommunicationSendMessage()
{
// 로그인 정보 체크
if (!Context::get('is_logged')) {
return new Object(-1, 'msg_not_logged');
}
$logged_info = Context::get('logged_info');
// 변수 검사
$receiver_srl = Context::get('receiver_srl');
if (!$receiver_srl) {
return new Object(-1, 'msg_not_exists_member');
}
$title = trim(Context::get('title'));
if (!$title) {
return new Object(-1, 'msg_title_is_null');
}
$content = trim(Context::get('content'));
if (!$content) {
return new Object(-1, 'msg_content_is_null');
}
$send_mail = Context::get('send_mail');
if ($send_mail != 'Y') {
$send_mail = 'N';
}
// 받을 회원이 있는지에 대한 검사
$oMemberModel =& getModel('member');
$oCommunicationModel =& getModel('communication');
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
if ($receiver_member_info->member_srl != $receiver_srl) {
return new Object(-1, 'msg_not_exists_member');
}
// 받을 회원의 쪽지 수신여부 검사 (최고관리자이면 패스)
if ($logged_info->is_admin != 'Y') {
if ($receiver_member_info->allow_message == 'F') {
if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) {
return new object(-1, 'msg_allow_message_to_friend');
}
} elseif ($receiver_member_info->allow_messge == 'N') {
return new object(-1, 'msg_disallow_message');
}
}
// 쪽지 발송
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
// 메일로도 발송
if ($output->toBool() && $send_mail == 'Y') {
$view_url = Context::getRequestUri();
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
$oMail = new Mail();
$oMail->setTitle($title);
$oMail->setContent($content);
$oMail->setSender($logged_info->user_name, $logged_info->email_address);
$oMail->setReceiptor($receiver_member_info->user_name, $receiver_member_info->email_address);
$oMail->send();
}
return $output;
}
示例3: sendMessages
function sendMessages($content, $mail_content, $title, $sender, $config)
{
$oTextmessageController = &getController('textmessage');
$oPaynotyModel = &getModel('paynoty');
if (in_array($config->sending_method,array('1','2'))&&$oTextmessageController)
{
$args->recipient_no = explode(',',$config->admin_phones);
//$args->sender_no = $receiver->recipient_no;
$args->content = $content;
$output = $oTextmessageController->sendMessage($args);
if (!$output->toBool()) return $output;
}
if (in_array($config->sending_method,array('1','3')))
{
if ($config->sender_email)
{
$sender_email_address = $config->sender_email;
}
else
{
$sender_email_address = $sender->email_address;
}
if ($config->sender_name)
{
$sender_name = $config->sender_name;
}
else
{
$sender_name = $sender->nick_name;
}
$oMail = new Mail();
$oMail->setTitle($title);
$oMail->setContent($mail_content);
$oMail->setSender($sender_name, $sender_email_address);
$target_email = explode(',',$config->admin_emails);
foreach ($target_email as $email_address)
{
$email_address = trim($email_address);
if (!$email_address) continue;
$oMail->setReceiptor($email_address, $email_address);
$oMail->send();
}
}
return new Object();
}
示例4: create
public function create()
{
try {
$profileId = UserHelper::getProfileId();
$mail = new Mail();
$mail->setSender($profileId);
$mail->setContent(trim(fRequest::get('mail-content')));
$re = trim(fRequest::get('dest'));
if (empty($re)) {
$re = trim(fRequest::get('destre', 'integer'));
$pa = trim(fRequest::get('parent', 'integer', -1));
$x = new Profile($re);
$mail->setReceiver($re);
$mail->setParent($pa);
} else {
//$receiver=fRecordSet::build('Profile',array('login_name=' => $re ),array())->getRecord(0);
$receiver = fRecordSet::build('Profile', array('login_name=' => $re), array());
if ($receiver->count()) {
$receiver = $receiver->getRecord(0);
} else {
throw new fNotFoundException('user doesn\'t exist');
}
$mail->setReceiver($receiver->getId());
}
if (strlen($mail->getContent()) < 1) {
throw new fValidationException('信息长度不能少于1个字符');
}
if (strlen($mail->getContent()) > 140) {
throw new fValidationException('信息长度不能超过140个字符');
}
$mail->store();
//Activity::fireNewTweet();
fMessaging::create('success', 'create mail', '信息发送成功!');
} catch (fNotFoundException $e) {
fMessaging::create('failure', 'create mail', '该用户名不存在,或该用户没有创建个人资料!');
} catch (fException $e) {
fMessaging::create('failure', 'create mail', $e->getMessage());
}
fURL::redirect(SITE_BASE . '/inbox');
}
示例5: procCommentAdminChangeStatus
/**
* Change comment status
* @return void|object
*/
function procCommentAdminChangeStatus()
{
$will_publish = Context::get('will_publish');
// Error display if none is selected
$cart = Context::get('cart');
if (!$cart) {
return $this->stop('msg_cart_is_null');
}
if (!is_array($cart)) {
$comment_srl_list = explode('|@|', $cart);
} else {
$comment_srl_list = $cart;
}
$args = new stdClass();
$args->status = $will_publish;
$args->comment_srls_list = $comment_srl_list;
$output = executeQuery('comment.updatePublishedStatus', $args);
if (!$output->toBool()) {
return $output;
} else {
//update comment count for document
$updated_documents_arr = array();
// create the controller object of the document
$oDocumentController = getController('document');
// create the model object of the document
$oDocumentModel = getModel('document');
// create the comment model object
$oCommentModel = getModel('comment');
//get admin info
$logged_info = Context::get('logged_info');
//$oMemberModule = getModel("member");
//$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl);
$new_status = $will_publish ? "published" : "unpublished";
foreach ($comment_srl_list as $comment_srl) {
// check if comment already exists
$comment = $oCommentModel->getComment($comment_srl);
if ($comment->comment_srl != $comment_srl) {
return new Object(-1, 'msg_invalid_request');
}
$document_srl = $comment->document_srl;
if (!in_array($document_srl, $updated_documents_arr)) {
$updated_documents_arr[] = $document_srl;
// update the number of comments
$comment_count = $oCommentModel->getCommentCount($document_srl);
// update comment count of the article posting
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, NULL, FALSE);
$oDocument = $oDocumentModel->getDocument($document_srl);
$author_email = $oDocument->variables['email_address'];
$oModuleModel = getModel("module");
$module_info = $oModuleModel->getModuleInfoByModuleSrl($comment->module_srl);
$already_sent = array();
// send email to comment's author, all admins and thread(document) subscribers - START
// -------------------------------------------------------
$oMail = new Mail();
$mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\"";
$oMail->setTitle($mail_title);
$mail_content = "\n\t\t\t\t\t\tThe comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module.\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<br />Comment content:\n\t\t\t\t\t\t" . $comment->content . "\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t";
$oMail->setContent($mail_content);
$oMail->setSender($logged_info->user_name, $logged_info->email_address);
$document_author_email = $oDocument->variables['email_address'];
//mail to author of thread - START
/**
* @todo Removed code send email to document author.
*/
/*
if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email)
{
$oMail->setReceiptor($document_author_email, $document_author_email);
$oMail->send();
$already_sent[] = $document_author_email;
}
*/
//mail to author of thread - STOP
//mail to all emails set for administrators - START
if ($module_info->admin_mail) {
$target_mail = explode(',', $module_info->admin_mail);
for ($i = 0; $i < count($target_mail); $i++) {
$email_address = trim($target_mail[$i]);
if (!$email_address) {
continue;
}
if ($author_email != $email_address) {
$oMail->setReceiptor($email_address, $email_address);
$oMail->send();
}
}
}
//mail to all emails set for administrators - STOP
}
// ----------------------------------------------------------
// send email to comment's author, all admins and thread(document) subscribers - STOP
}
// call a trigger for calling "send mail to subscribers" (for moment just for forum)
ModuleHandler::triggerCall("comment.procCommentAdminChangeStatus", "after", $comment_srl_list);
}
// for message send - start
//.........这里部分代码省略.........
示例6: insertMember
//.........这里部分代码省略.........
if ($member_srl) {
return new Object(-1, 'msg_exists_user_id');
}
$member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
if ($member_srl) {
return new Object(-1, 'msg_exists_nick_name');
}
$member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
if ($member_srl) {
return new Object(-1, 'msg_exists_email_address');
}
$oDB =& DB::getInstance();
$oDB->begin();
// DB에 입력
$args->member_srl = getNextSequence();
if ($args->password && !$password_is_hashed) {
$args->password = md5($args->password);
} elseif (!$args->password) {
unset($args->password);
}
$output = executeQuery('member.insertMember', $args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 입력된 그룹 값이 없으면 기본 그룹의 값을 등록
if (!$args->group_srl_list) {
$default_group = $oMemberModel->getDefaultGroup(0);
// 기본 그룹에 추가
$output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 입력된 그룹 값이 있으면 해당 그룹의 값을 등록
} else {
$group_srl_list = explode('|@|', $args->group_srl_list);
for ($i = 0; $i < count($group_srl_list); $i++) {
$output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
}
}
// 메일 인증 모드 사용시(가입된 회원이 denied일 때) 인증 메일 발송
if ($args->denied == 'Y') {
// 인증 DB에 데이터를 넣음
$auth_args->user_id = $args->user_id;
$auth_args->member_srl = $args->member_srl;
$auth_args->new_password = $args->password;
$auth_args->auth_key = md5(rand(0, 999999));
$auth_args->is_register = 'Y';
$output = executeQuery('member.insertAuthMail', $auth_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 메일 내용을 구함
Context::set('auth_args', $auth_args);
Context::set('member_info', $args);
$member_config = $oModuleModel->getModuleConfig('member');
if (!$member_config->skin) {
$this->member_config->skin = "default";
}
if (!$member_config->colorset) {
$this->member_config->colorset = "white";
}
Context::set('member_config', $member_config);
$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
if (!is_dir($tpl_path)) {
$tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
}
$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $args->member_srl, 'auth_key', $auth_args->auth_key);
Context::set('auth_url', $auth_url);
$oTemplate =& TemplateHandler::getInstance();
$content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail');
// 사이트 웹마스터 정보를 구함
$oModuleModel =& getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
// 메일 발송
$oMail = new Mail();
$oMail->setTitle(Context::getLang('msg_confirm_account_title'));
$oMail->setContent($content);
$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
$oMail->setReceiptor($args->user_name, $args->email_address);
$oMail->send();
}
// trigger 호출 (after)
if ($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args);
if (!$trigger_output->toBool()) {
$oDB->rollback();
return $trigger_output;
}
}
$oDB->commit(true);
$output->add('member_srl', $args->member_srl);
return $output;
}
示例7: procCommunicationSendMessage
/**
* Send a message
* @return Object
*/
function procCommunicationSendMessage()
{
// Check login information
if (!Context::get('is_logged')) {
return new Object(-1, 'msg_not_logged');
}
$logged_info = Context::get('logged_info');
// Check variables
$receiver_srl = Context::get('receiver_srl');
if (!$receiver_srl) {
return new Object(-1, 'msg_not_exists_member');
}
$title = trim(Context::get('title'));
if (!$title) {
return new Object(-1, 'msg_title_is_null');
}
$content = trim(Context::get('content'));
if (!$content) {
return new Object(-1, 'msg_content_is_null');
}
$send_mail = Context::get('send_mail');
if ($send_mail != 'Y') {
$send_mail = 'N';
}
// Check if there is a member to receive a message
$oMemberModel = getModel('member');
$oCommunicationModel = getModel('communication');
$config = $oCommunicationModel->getConfig();
if (!$oCommunicationModel->checkGrant($config->grant_write)) {
return new Object(-1, 'msg_not_permitted');
}
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
if ($receiver_member_info->member_srl != $receiver_srl) {
return new Object(-1, 'msg_not_exists_member');
}
// check whether to allow to receive the message(pass if a top-administrator)
if ($logged_info->is_admin != 'Y') {
if ($receiver_member_info->allow_message == 'F') {
if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) {
return new object(-1, 'msg_allow_message_to_friend');
}
} else {
if ($receiver_member_info->allow_message == 'N') {
return new object(-1, 'msg_disallow_message');
}
}
}
// send a message
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
if (!$output->toBool()) {
return $output;
}
// send an e-mail
if ($send_mail == 'Y') {
$view_url = Context::getRequestUri();
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
$oMail = new Mail();
$oMail->setTitle(htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$oMail->setContent(removeHackTag($content));
$oMail->setSender($logged_info->nick_name, $logged_info->email_address);
$oMail->setReceiptor($receiver_member_info->nick_name, $receiver_member_info->email_address);
$oMail->send();
}
if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
if (Context::get('is_popup') != 'Y') {
global $lang;
htmlHeader();
alertScript($lang->success_sended);
closePopupScript();
htmlFooter();
Context::close();
exit;
} else {
$this->setMessage('success_sended');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
$this->setRedirectUrl($returnUrl);
}
}
return $output;
}
示例8: procIssuetrackerInsertIssue
function procIssuetrackerInsertIssue()
{
// 권한 체크
if (!$this->grant->ticket_write) {
return new Object(-1, 'msg_not_permitted');
}
// 글작성시 필요한 변수를 세팅
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
if (!$obj->title) {
$obj->title = cut_str(strip_tags($obj->content), 20, '...');
}
// 관리자가 아니라면 게시글 색상/굵기 제거
if (!$this->grant->manager) {
unset($obj->title_color);
unset($obj->title_bold);
}
// 커미터가 아니라면 마일스톤(계획), 우선순위, 소유자 설정 제거
// (이슈 상태는 여기서 건드릴수없음 / 종류, 컴포넌트, 패키지 설정은 ticket_write권한이면 가능)
if (!$this->grant->commiter) {
unset($obj->assignee_srl);
unset($obj->milestone_srl);
unset($obj->priority_srl);
}
if ($obj->release_srl) {
$obj->occured_version_srl = $obj->release_srl;
}
if ($obj->occured_version_srl == 0) {
unset($obj->occured_version_srl);
}
// document module의 model 객체 생성
$oDocumentModel =& getModel('document');
// document module의 controller 객체 생성
$oDocumentController =& getController('document');
// 이미 존재하는 글인지 체크
$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
// 이미 존재하는 경우 수정
if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
$output = $oDocumentController->updateDocument($oDocument, $obj);
$msg_code = 'success_updated';
if (!$output->toBool()) {
return $output;
}
// 그렇지 않으면 신규 등록
} else {
// assignee name
$oMemberModel =& getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->assignee_srl);
$obj->assignee_name = $member_info->nick_name;
// transaction start
$oDB =& DB::getInstance();
$oDB->begin();
$output = executeQuery("issuetracker.insertIssue", $obj);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$output = $oDocumentController->insertDocument($obj);
$msg_code = 'success_registed';
$obj->document_srl = $output->get('document_srl');
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$oDB->commit();
// 문제가 없고 모듈 설정에 관리자 메일이 등록되어 있으면 메일 발송
if ($output->toBool() && $this->module_info->admin_mail) {
$oMail = new Mail();
$oMail->setTitle($obj->title);
$oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getUrl('', 'document_srl', $obj->document_srl), getUrl('', 'document_srl', $obj->document_srl), $obj->content));
$oMail->setSender($obj->user_name, $obj->email_address);
$target_mail = explode(',', $this->module_info->admin_mail);
for ($i = 0; $i < count($target_mail); $i++) {
$email_address = trim($target_mail[$i]);
if (!$email_address) {
continue;
}
$oMail->setReceiptor($email_address, $email_address);
$oMail->send();
}
}
}
// 오류 발생시 멈춤
if (!$output->toBool()) {
return $output;
}
// 결과를 리턴
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $output->get('document_srl'));
// 성공 메세지 등록
$this->setMessage($msg_code);
}
示例9: procMemberModifyEmailAddress
function procMemberModifyEmailAddress()
{
if (!Context::get('is_logged')) {
return $this->stop('msg_not_logged');
}
$member_info = Context::get('logged_info');
$newEmail = Context::get('email_address');
if (!$newEmail) {
return $this->stop('msg_invalid_request');
}
$oMemberModel = getModel('member');
// Check managed Email Host
if ($oMemberModel->isDeniedEmailHost($newEmail)) {
$config = $oMemberModel->getMemberConfig();
$emailhost_check = $config->emailhost_check;
$managed_email_host = lang('managed_email_host');
$email_hosts = $oMemberModel->getManagedEmailHosts();
foreach ($email_hosts as $host) {
$hosts[] = $host->email_host;
}
$message = sprintf($managed_email_host[$emailhost_check], implode(', ', $hosts), 'id@' . implode(', id@', $hosts));
return new Object(-1, $message);
}
// Check if the e-mail address is already registered
$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
if ($member_srl) {
return new Object(-1, 'msg_exists_email_address');
}
if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') {
return $this->stop('msg_invalid_request');
}
unset($_SESSION['rechecked_password_step']);
$auth_args = new stdClass();
$auth_args->user_id = $newEmail;
$auth_args->member_srl = $member_info->member_srl;
$auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex');
$auth_args->new_password = 'XE_change_emaill_address';
$oDB =& DB::getInstance();
$oDB->begin();
$output = executeQuery('member.insertAuthMail', $auth_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$oModuleModel = getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
if (!is_dir($tpl_path)) {
$tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
}
global $lang;
$memberInfo = array();
$memberInfo[$lang->email_address] = $member_info->email_address;
$memberInfo[$lang->nick_name] = $member_info->nick_name;
Context::set('memberInfo', $memberInfo);
Context::set('newEmail', $newEmail);
$auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
Context::set('auth_url', $auth_url);
$oTemplate =& TemplateHandler::getInstance();
$content = $oTemplate->compile($tpl_path, 'confirm_member_new_email');
$oMail = new Mail();
$oMail->setTitle(lang('title_modify_email_address'));
$oMail->setContent($content);
$oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
$oMail->setReceiptor($member_info->nick_name, $newEmail);
$result = $oMail->send();
$msg = sprintf(lang('msg_confirm_mail_sent'), $newEmail);
$this->setMessage($msg);
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
$this->setRedirectUrl($returnUrl);
}
示例10: procContactSendEmail
/**
* @brief send email
**/
function procContactSendEmail()
{
$logged_info = Context::get('logged_info');
if ($this->module_info->send_grant_all != 'Y' && !$logged_info) {
return new Object(-1, 'msg_logged_can_send_mail');
}
if (!$this->module_info->admin_mail) {
return new Object(-1, 'msg_do_set_admin_mail');
}
$oMail = new Mail();
$oMail->setContentType("plain");
// get form variables submitted
$obj = Context::getRequestVars();
if ($obj->enable_terms == 'Y' && !$obj->check_agree) {
return new Object(-1, 'msg_terms_of_license_agreement');
}
$obj->email = $obj->Email;
$obj->subject = $obj->Subject;
$obj->comment = $obj->Comment;
$oDocumentModel =& getModel('document');
$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
$mail_content = array();
$filter_lang = Context::getLang('filter');
$content = '';
if (count($extra_keys)) {
$oModuleController =& getController('module');
foreach ($extra_keys as $idx => $extra_item) {
$value = '';
if (isset($obj->{'extra_vars' . $idx})) {
$value = $obj->{'extra_vars' . $idx};
} elseif (isset($obj->{$extra_item->eid})) {
$value = $obj->{$extra_item->eid};
}
if (!is_array($value)) {
$value = trim($value);
}
if (!isset($value)) {
continue;
}
//check if extra item is required
$oModuleController->replaceDefinedLangCode($extra_item->name);
if ($extra_item->is_required == 'Y' && $value == "") {
return new Object(-1, sprintf($filter_lang->invalid, $extra_item->name));
}
//if the type of form component is email address
if ($extra_item->type == 'email_address' && !$oMail->isVaildMailAddress($value)) {
return new Object(-1, sprintf($filter_lang->invalid_email, $extra_item->name));
}
if ($extra_item->type == "tel") {
$mail_content[$extra_item->eid] = $obj->{'extra_vars' . $idx}[2];
$content .= $extra_item->name . ': ' . $obj->{'extra_vars' . $idx}[2] . "\r\n";
} elseif (is_array($obj->{'extra_vars' . $idx})) {
$mail_content[$extra_item->eid] = implode(",", $obj->{'extra_vars' . $idx});
$content .= $extra_item->name . ': ' . implode(",", $obj->{'extra_vars' . $idx}) . "\r\n";
} else {
$mail_content[$extra_item->eid] = $value;
$content .= $extra_item->name . ': ' . $value . "\r\n";
}
$mail_title[$extra_item->eid] = htmlspecialchars($extra_item->name);
}
}
if (!$oMail->isVaildMailAddress($obj->email)) {
return new Object(-1, sprintf($filter_lang->invalid_email, Context::getLang('email_address')));
}
$oMail->setTitle($obj->subject);
$content_all = $content . "\r\nComments:\r\n" . htmlspecialchars($obj->comment);
$mail_content['Comments'] = $obj->comment;
$oMail->setContent(htmlspecialchars($content_all));
//$oMail->setSender("XE Contact Us", $obj->email);
$oMail->setSender($obj->email . "(" . $_SERVER['REMOTE_ADDR'] . ")", $obj->email);
$target_mail = explode(',', $this->module_info->admin_mail);
for ($i = 0; $i < count($target_mail); $i++) {
$email_address = trim($target_mail[$i]);
if (!$email_address || !$oMail->isVaildMailAddress($email_address)) {
continue;
}
$oMail->setReceiptor($email_address, $email_address);
if ($logged_info->is_admin != 'Y') {
if ($this->module_info->module_srl) {
$oModuleModel =& getModel('module');
$moduleExtraVars = $oModuleModel->getModuleExtraVars($this->module_info->module_srl);
if ($moduleExtraVars[$this->module_info->module_srl]->interval) {
$interval = $moduleExtraVars[$this->module_info->module_srl]->interval;
//transfer interval to mins
$interval = $interval * 60;
$oContactModel =& getModel('contact');
$output = $oContactModel->checkLimited($interval);
if (!$output->toBool()) {
return $output;
}
}
}
}
$oMail->send();
}
if (isset($_SESSION['mail_content'])) {
unset($_SESSION['mail_content']);
//.........这里部分代码省略.........
示例11: sendEmailsToSubscribers
/**
* send email to subscribers
* @param Newsletter $newsletter
* @param $site_srl
*/
public function sendEmailsToSubscribers(Newsletter $newsletter, $site_srl)
{
$shopModel = getModel('shop');
$customerRepository = $shopModel->getCustomerRepository();
$output = $customerRepository->getNewsletterCustomers($site_srl, 'Y');
$emails_list = "";
foreach ($output->customers as $customer) {
//add unsubscribe link to $newsletter->content;
$newsletter_content = $newsletter->content . "</br></br>" . sprintf(Context::getLang('unsubscribe_message'), getUrl('', 'act', 'procShopUnsignToNewsletter', 'member_srl', $customer->member_srl, 'email_address', $customer->email_address));
$oMail = new Mail();
$oMail->setTitle($newsletter->subject);
$oMail->setContent($newsletter_content);
$oMail->setSender($newsletter->sender_name, $newsletter->sender_email);
$oMail->setReceiptor(false, $customer->email_address);
$oMail->send();
}
}
示例12: sock_mail
\*-------------------------------*/
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$text = stripslashes($text);
?>
<?php
include_once 'mail.class.php';
$now = new Mail();
$now->setTo('example@mail.com');
$now->setFrom('foo@bar.com', 'User name');
$now->setSubject('Temat wiadomoœci');
$now->setContent('Treœæ wiadomoœci');
$now->addAttachment('/path/to/file.txt', 'text/plain');
$now->addAttachment('/path/to/file2.txt', 'text/plain');
echo 'Wysy³anie maila...';
echo $now->sendMail() ? 'OK' : 'FAILED';
?>
<?php
function sock_mail($to, $subj, $body, $head)
{
$auth = 0;
$from = "\"Ktoœ\" <adres@adres.pl>";
$loc_host = "localhost";
$smtp_acc = "uzytkownik";
示例13: sendNewOrderMailToAdministrator
private static function sendNewOrderMailToAdministrator($shop, $order)
{
// Don't send anything if admin email is not configured
if (!$shop->getEmail()) {
ShopLogger::log("Failed to send order email to admin for order #{$order->order_srl}; Admin email is not configured");
return;
}
global $lang;
$admin_email_subject = sprintf($lang->admin_order_email_subject, $order->client_name, ShopDisplay::priceFormat($order->total, $shop->getCurrencySymbol()));
Context::set('email_order', $order);
$oTemplateHandler = TemplateHandler::getInstance();
$order_content = $oTemplateHandler->compile('./modules/shop/tpl', 'order_email.html');
$admin_email_content = sprintf($lang->admin_order_email_content, getFullSiteUrl('', 'act', 'dispShopToolViewOrder', 'order_srl', $order->order_srl), $order->order_srl, $order_content);
$oMail = new Mail();
$oMail->setTitle($admin_email_subject);
$oMail->setContent($admin_email_content);
$oMail->setSender($shop->getShopTitle(), $shop->getShopEmail());
$oMail->setReceiptor(false, $shop->getEmail());
$oMail->send();
}
示例14: procBoardInsertDocument
/**
* @brief insert document
**/
function procBoardInsertDocument()
{
// check grant
if ($this->module_info->module != "board") {
return new Object(-1, "msg_invalid_request");
}
if (!$this->grant->write_document) {
return new Object(-1, 'msg_not_permitted');
}
$logged_info = Context::get('logged_info');
// setup variables
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
if ($obj->is_notice != 'Y' || !$this->grant->manager) {
$obj->is_notice = 'N';
}
$obj->commentStatus = $obj->comment_status;
settype($obj->title, "string");
if ($obj->title == '') {
$obj->title = cut_str(strip_tags($obj->content), 20, '...');
}
//setup dpcument title tp 'Untitled'
if ($obj->title == '') {
$obj->title = 'Untitled';
}
// unset document style if the user is not the document manager
if (!$this->grant->manager) {
unset($obj->title_color);
unset($obj->title_bold);
}
// generate document module model object
$oDocumentModel =& getModel('document');
// generate document module의 controller object
$oDocumentController =& getController('document');
// check if the document is existed
$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
// if use anonymous is true
if ($this->module_info->use_anonymous == 'Y') {
$obj->notify_message = 'N';
$this->module_info->admin_mail = '';
$obj->member_srl = -1 * $logged_info->member_srl;
$obj->email_address = $obj->homepage = $obj->user_id = '';
$obj->user_name = $obj->nick_name = 'anonymous';
$bAnonymous = true;
$oDocument->add('member_srl', $obj->member_srl);
} else {
$bAnonymous = false;
}
// update the document if it is existed
if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
if (!$oDocument->isGranted()) {
return new Object(-1, 'msg_not_permitted');
}
if (!$this->grant->manager) {
// notice & document style same as before if not manager
$obj->is_notice = $oDocument->get('is_notice');
$obj->title_color = $oDocument->get('title_color');
$obj->title_bold = $oDocument->get('title_bold');
}
$output = $oDocumentController->updateDocument($oDocument, $obj);
$msg_code = 'success_updated';
// insert a new document otherwise
} else {
$output = $oDocumentController->insertDocument($obj, $bAnonymous);
$msg_code = 'success_registed';
$obj->document_srl = $output->get('document_srl');
// send an email to admin user
if ($output->toBool() && $this->module_info->admin_mail) {
$oMail = new Mail();
$oMail->setTitle($obj->title);
$oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content));
$oMail->setSender($obj->user_name, $obj->email_address);
$target_mail = explode(',', $this->module_info->admin_mail);
for ($i = 0; $i < count($target_mail); $i++) {
$email_address = trim($target_mail[$i]);
if (!$email_address) {
continue;
}
$oMail->setReceiptor($email_address, $email_address);
$oMail->send();
}
}
}
// if there is an error
if (!$output->toBool()) {
return $output;
}
// return the results
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $output->get('document_srl'));
// alert a message
$this->setMessage($msg_code);
}
示例15: importMember
//.........这里部分代码省略.........
$obj->point = base64_decode($xmlObj->member->point->body);
$obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body);
$obj->image_mark = base64_decode($xmlObj->member->image_mark->buff->body);
$obj->profile_image = base64_decode($xmlObj->member->profile_image->buff->body);
$obj->signature = base64_decode($xmlObj->member->signature->body);
$obj->regdate = base64_decode($xmlObj->member->regdate->body);
$obj->last_login = base64_decode($xmlObj->member->last_login->body);
if ($xmlObj->member->extra_vars) {
foreach ($xmlObj->member->extra_vars as $key => $val) {
if (in_array($key, array('node_name', 'attrs', 'body'))) {
continue;
}
$obj->extra_vars->{$key} = base64_decode($val->body);
}
}
// Create url for homepage and blog
if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) {
$obj->homepage = 'http://' . $obj->homepage;
}
// email address column
$obj->email_address = $obj->email;
list($obj->email_id, $obj->email_host) = explode('@', $obj->email);
// Set the mailing option
if ($obj->allow_mailing != 'Y') {
$obj->allow_mailing = 'N';
}
// Set the message option
$obj->allow_message = 'Y';
if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) {
$obj->allow_message = 'Y';
}
// Get member-join date if the last login time is not found
if (!$obj->last_login) {
$obj->last_login = $obj->regdate;
}
// Get a member_srl
$obj->member_srl = getNextSequence();
$obj->list_order = -1 * $obj->member_srl;
// List extra vars
$extra_vars = $obj->extra_vars;
unset($obj->extra_vars);
$obj->extra_vars = serialize($extra_vars);
// Check if the same nickname is existing
$nick_args = new stdClass();
$nick_args->nick_name = $obj->nick_name;
$nick_output = executeQuery('member.getMemberSrl', $nick_args);
if (!$nick_output->toBool()) {
$obj->nick_name .= '_' . $obj->member_srl;
}
// Add a member
$output = executeQuery('member.insertMember', $obj);
if ($output->toBool() && !$obj->password) {
// Send a mail telling the user to reset his password.
$oMail = new Mail();
$oMail->setTitle("Password update for your " . getFullSiteUrl() . " account");
$webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster';
$oMail->setContent("Dear {$obj->user_name}, <br /><br />\n\t\t\t\t\t\tWe recently migrated our phpBB forum to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link:\n\t\t\t\t\t\t<a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br />\n\n\t\t\t\t\t\tThank you for your understanding,<br />\n\t\t\t\t\t\t{$webmaster_name}");
$oMail->setSender($webmaster_name, $member_config->webmaster_email);
$oMail->setReceiptor($obj->user_name, $obj->email);
$oMail->send();
}
// add group join/image name-mark-signiture and so on if a new member successfully added
if ($output->toBool()) {
// Join to the default group
$obj->group_srl = $default_group_srl;
executeQuery('member.addMemberToGroup', $obj);
// Image name
if ($obj->image_nickname) {
$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl));
$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $obj->image_nickname);
}
// Image mark
if ($obj->image_mark && file_exists($obj->image_mark)) {
$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl));
$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $obj->image_mark);
}
// Profile image
if ($obj->profile_image) {
$target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl));
$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $obj->profile_image);
}
// Signiture
if ($obj->signature) {
$signature = removeHackTag($obj->signature);
$signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
$target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl));
if (!is_dir($target_path)) {
FileHandler::makeDir($target_path);
}
$target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $signature_buff);
}
}
}
fclose($f);
return $idx - 1;
}