mailing refactored
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
508545248a
commit
1a81a7810f
2 changed files with 67 additions and 31 deletions
|
@ -21,39 +21,50 @@ class Mail_Handler{
|
|||
$sendingId = NULL;
|
||||
}
|
||||
|
||||
|
||||
$variables = Helpers::handle_language();
|
||||
$mailText = array();
|
||||
foreach ( $variables['email'] as $key => $value ){
|
||||
$mailText[$key] = $value;
|
||||
}
|
||||
|
||||
switch($type){
|
||||
case "REPLY":
|
||||
$webUser = new WebUsers($receiver);
|
||||
if($webUser->getReceiveMail()){
|
||||
$txt = "---------- Ticket #". $ticketObj->getTId() . " ----------\n You received a new reply on your ticket: " . $ticketObj->getTitle() .
|
||||
"\n --------------------\n\n";
|
||||
$subject = "New reply on [Ticket #" . $ticketObj->getTId() ."]";
|
||||
$endTxt = "\n\n----------\nYou can reply on this message to answer directly on the ticket!";
|
||||
$txt = $txt . $content . $endTxt;
|
||||
if($webUser->getReceiveMail()){
|
||||
$subject = $mailText['email_subject_new_reply'] . $ticketObj->getTId() ."]";
|
||||
$txt = $mailText['email_body_new_reply_1']. $ticketObj->getTId() . $mailText['email_body_new_reply_2'] . $ticketObj->getTitle() .
|
||||
$mailText['email_body_new_reply_3'] . $content . $mailText['email_body_new_reply_4'];
|
||||
self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(),$sendingId);
|
||||
}
|
||||
break;
|
||||
|
||||
case "NEW":
|
||||
$webUser = new WebUsers($receiver);
|
||||
if($webUser->getReceiveMail()){
|
||||
$txt = "---------- Ticket #". $ticketObj->getTId() . " ----------\n Your ticket: " . $ticketObj->getTitle() . " is newly created";
|
||||
$txt = $txt . "\n --------------------\n\n";
|
||||
$subject = "New ticket created [Ticket #" . $ticketObj->getTId() ."]";
|
||||
$endTxt = "\n\n----------\nYou can reply on this message to answer directly on the ticket!";
|
||||
$txt = $txt . $content . $endTxt;
|
||||
if($webUser->getReceiveMail()){
|
||||
$subject = $mailText['email_subject_new_ticket'] . $ticketObj->getTId() ."]";
|
||||
$txt = $mailText['email_body_new_ticket_1'] . $ticketObj->getTId() . $mailText['email_body_new_ticket_2'] . $ticketObj->getTitle() . $mailText['email_body_new_ticket_3']
|
||||
. $content . $mailText['email_body_new_ticket_4'];
|
||||
self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), $sendingId);
|
||||
}
|
||||
break;
|
||||
|
||||
case "WARNAUTHOR":
|
||||
$subject = $mailText['email_subject_warn_author'] . $ticketObj->getTId() ."]";
|
||||
$txt = $mailText['email_body_warn_author_1'] . $ticket->getTitle() .$mailText['email_body_warn_author_2'].$fromEmail.$mailText['email_body_warn_author_3'].
|
||||
$fromEmail. $mailText['email_body_warn_author_4'] ;
|
||||
self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), $sendingId);
|
||||
break;
|
||||
|
||||
case "WARNSENDER":
|
||||
$subject = $mailText['email_subject_warn_sender'];
|
||||
$txt = $mailText['email_body_warn_sender'];
|
||||
self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), $sendingId);
|
||||
break;
|
||||
|
||||
case "WARNUNKNOWNSENDER":
|
||||
$subject = $mailText['email_subject_warn_unknown_sender'];
|
||||
$txt = $mailText['email_body_warn_unknown_sender'];
|
||||
self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), $sendingId);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -288,16 +299,7 @@ class Mail_Handler{
|
|||
}else{
|
||||
//if user has no access to it
|
||||
//Warn real ticket owner + person that send the mail
|
||||
/*$subject_warnAuthor = "Someone tried to reply to your ticket: [Ticket #" . $ticket->getTId() ."]";
|
||||
$body_warnAuthor = "Someone tried to reply at your ticket: " . $ticket->getTitle() ."by sending an email from ".$fromEmail."! Please use the email address matching to your account if you want to auto reply!\n\n
|
||||
If ". $fromEmail. " isn't one of your email addresses, please contact us by replying to this ticket!" ;
|
||||
Mail_Handler::send_mail($ticket->getAuthor(), $subject_warnAuthor , $body_warnAuthor, $ticket->getTId(), NULL);*/
|
||||
Mail_Handler::send_ticketing_mail($ticket->getAuthor(),$ticket, NULL , "WARNAUTHOR" , NULL);
|
||||
|
||||
/*$subject_warnSender = "You tried to reply to someone elses ticket!";
|
||||
$body_warnSender = "It seems you tried to reply to someone elses ticket, please use the matching email address to that account!\n\n
|
||||
This action is notified to the real ticket owner!" ;
|
||||
Mail_Handler::send_mail($from, $subject_warnSender , $body_warnSender, $ticket->getTId(), NULL);*/
|
||||
Mail_Handler::send_ticketing_mail($from ,$ticket, NULL , "WARNSENDER" , NULL);
|
||||
|
||||
error_log("Email found that was a reply to a ticket, though send by another user to ".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH);
|
||||
|
@ -308,16 +310,7 @@ class Mail_Handler{
|
|||
|
||||
//if a reply to a ticket is being sent by a non-user!
|
||||
//Warn real ticket owner + person that send the mail
|
||||
/*$subject_warnAuthor = "Someone tried to reply to your ticket: [Ticket #" . $ticket->getTId() ."]";
|
||||
$body_warnAuthor = "Someone tried to reply at your ticket:' " . $ticket->getTitle() ."' by sending an email from ".$fromEmail." ! Please use the email address matching to your account if you want to auto reply!\n\n
|
||||
If ". $fromEmail. " isn't one of your email addresses, please contact us by replying to this ticket!" ;
|
||||
Mail_Handler::send_mail($ticket->getAuthor(), $subject_warnAuthor , $body_warnAuthor, $ticket->getTId(), NULL);*/
|
||||
Mail_Handler::send_ticketing_mail($ticket->getAuthor() ,$ticket, NULL , "WARNAUTHOR" , NULL);
|
||||
|
||||
/*$subject_warnSender = "You tried to reply to someone's ticket!";
|
||||
$body_warnSender = "It seems you tried to reply to someone's ticket, However this email address isn't linked to any account, please use the matching email address to that account!\n\n
|
||||
This action is notified to the real ticket owner!" ;
|
||||
Mail_Handler::send_mail($fromEmail, $subject_warnSender , $body_warnSender, $ticket->getTId(), NULL);*/
|
||||
Mail_Handler::send_ticketing_mail($fromEmail ,$ticket, NULL , "WARNUNKNOWNSENDER" , NULL);
|
||||
|
||||
error_log("Email found that was a reply to a ticket, though send by an unknown email address to ".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH);
|
||||
|
|
|
@ -137,3 +137,46 @@ tac_tag1= "YES, I agree to the "
|
|||
tac_tag2="terms of service"
|
||||
tac_message = "You must accept the Terms of Service."
|
||||
|
||||
|
||||
[email]
|
||||
email_subject_new_reply = "New reply on [Ticket #"
|
||||
email_body_new_reply_1 = "---------- Ticket #"
|
||||
email_body_new_reply_2 = " ----------
|
||||
You received a new reply on your ticket: "
|
||||
email_body_new_reply_3 = "
|
||||
--------------------
|
||||
Reply Content:
|
||||
"
|
||||
email_body_new_reply_4 = "
|
||||
--------------------
|
||||
You can reply on this message to answer directly on the ticket!"
|
||||
|
||||
email_subject_new_ticket = "New ticket created [Ticket #"
|
||||
email_body_new_ticket_1 = "---------- Ticket #"
|
||||
email_body_new_ticket_2 = " ----------
|
||||
Your ticket: "
|
||||
email_body_new_ticket_3 = " is newly created
|
||||
----------
|
||||
"
|
||||
email_body_new_ticket_4 = "
|
||||
----------
|
||||
You can reply on this message to answer directly on the ticket!"
|
||||
|
||||
email_subject_warn_author = "Someone tried to reply to your ticket: [Ticket #"
|
||||
email_body_warn_author_1 = "Someone tried to reply at your ticket: "
|
||||
email_body_warn_author_2 = " by sending an email from "
|
||||
email_body_warn_author_3 = " ! Please use the email address matching to your account if you want to auto reply
|
||||
|
||||
If "
|
||||
email_body_warn_author_4 = " isn't one of your email addresses, please contact us by replying to this ticket!"
|
||||
|
||||
email_subject_warn_sender = "You tried to reply to someone elses ticket!"
|
||||
email_body_warn_sender = "It seems you tried to reply to someone elses ticket, please use the matching email address to that account!
|
||||
|
||||
This action is notified to the real ticket owner!"
|
||||
|
||||
|
||||
email_subject_warn_unknown_sender = "You tried to reply to someone's ticket!"
|
||||
email_body_warn_unknown_sender = "It seems you tried to reply to someone's ticket, However this email address isn't linked to any account, please use the matching email address to that account!
|
||||
|
||||
This action is notified to the real ticket owner!"
|
Loading…
Reference in a new issue