Outgoing emails to be encoded in ISO-8859-15 (ASCII)
This commit is contained in:
parent
b6baa8ecd8
commit
8b6312ad47
|
|
@ -258,7 +258,7 @@ class EnquiriesController extends AppController {
|
||||||
'timeout' => '15',
|
'timeout' => '15',
|
||||||
'host' => '192.168.0.6');
|
'host' => '192.168.0.6');
|
||||||
$this->Email->delivery = 'smtp';
|
$this->Email->delivery = 'smtp';
|
||||||
|
$this->Email->charset = 'iso-8859-15';
|
||||||
$enquiry = $this->Enquiry->read(null, $id);
|
$enquiry = $this->Enquiry->read(null, $id);
|
||||||
$this->Email->to = $enquiry['Contact']['email'];
|
$this->Email->to = $enquiry['Contact']['email'];
|
||||||
$this->Email->cc = array($enquiry['User']['email']);
|
$this->Email->cc = array($enquiry['User']['email']);
|
||||||
|
|
@ -269,6 +269,7 @@ class EnquiriesController extends AppController {
|
||||||
$this->Email->from = 'CMC Technologies - Sales <sales@cmctechnologies.com.au>';
|
$this->Email->from = 'CMC Technologies - Sales <sales@cmctechnologies.com.au>';
|
||||||
$this->Email->template = 'enquiry_added';
|
$this->Email->template = 'enquiry_added';
|
||||||
$this->Email->sendAs = 'both';
|
$this->Email->sendAs = 'both';
|
||||||
|
|
||||||
$this->set('enquiry', $enquiry);
|
$this->set('enquiry', $enquiry);
|
||||||
if($this->Email->send()) {
|
if($this->Email->send()) {
|
||||||
$this->Session->setFlash(__('The Enquiry has been added and the Contact has been emailed', true));
|
$this->Session->setFlash(__('The Enquiry has been added and the Contact has been emailed', true));
|
||||||
|
|
|
||||||
31
vendors/shells/vault.php
vendored
31
vendors/shells/vault.php
vendored
|
|
@ -13,11 +13,11 @@ class VaultShell extends Shell {
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* Config Variables
|
* Config Variables
|
||||||
* *****************************************************/
|
* *****************************************************/
|
||||||
$testing = 1; //Whether to actually move the emails. 1=test, 0=production
|
$testing = 0; //Whether to actually move the emails. 1=test, 0=production
|
||||||
/* Setup Connection to the IMAP server */
|
/* Setup Connection to the IMAP server */
|
||||||
$username = 'vault';
|
$username = 'vault';
|
||||||
$password = 'xjdYOsmJWc37'; /* The password for the account to be checked */
|
$password = 'xjdYOsmJWc37'; /* The password for the account to be checked */
|
||||||
$email_dir = '/var/www/quotenik1.2/app/emails/working';
|
$email_dir = '/var/www/cakephp/app/emails/working';
|
||||||
$temp_filename = 'temp.eml';
|
$temp_filename = 'temp.eml';
|
||||||
|
|
||||||
$mbox = imap_open("{saturn:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error());
|
$mbox = imap_open("{saturn:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error());
|
||||||
|
|
@ -27,11 +27,10 @@ class VaultShell extends Shell {
|
||||||
/* Loop through the messages and sort them into ones to be processed or discarded */
|
/* Loop through the messages and sort them into ones to be processed or discarded */
|
||||||
for ($i=1; $i <= $number_of_messages; $i++) {
|
for ($i=1; $i <= $number_of_messages; $i++) {
|
||||||
$this_header = imap_headerinfo($mbox, $i);
|
$this_header = imap_headerinfo($mbox, $i);
|
||||||
$enquiry = $this->checkIfValidEnquiry($mbox, $i, $this_header, $testing);
|
$message = $this->getMessage($mbox, $i, $this_header);
|
||||||
if($enquiry != FALSE) {
|
$enquiry = $this->checkIfValidEnquiry($message['subject'], $testing);
|
||||||
|
if($enquiry) {
|
||||||
//Process it and store the message and its attachments.
|
//Process it and store the message and its attachments.
|
||||||
|
|
||||||
$message = $this->getMessage($mbox, $i, $this_header);
|
|
||||||
$this->Email->create();
|
$this->Email->create();
|
||||||
$this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id'];
|
$this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id'];
|
||||||
$this->data['Email']['to'] = $message['to'];
|
$this->data['Email']['to'] = $message['to'];
|
||||||
|
|
@ -238,28 +237,26 @@ function getBody($mbox, $msgnumber) {
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIfValidEnquiry($mbox, $msgnumber, $this_header, $testing) {
|
function checkIfValidEnquiry($subject, $testing) {
|
||||||
|
|
||||||
|
$output = array();
|
||||||
|
|
||||||
|
|
||||||
|
preg_match("/CMC\d+([NVQWSO]|ACT|NT)E\d+-\d+/", $subject, $output);
|
||||||
|
|
||||||
preg_match("/CMC\d+([NVQWSO]|ACT|NT)E\d+-\d+/", $this_header->subject, $output);
|
|
||||||
if(isset($output[0])) { //Found a valid-looking Enquiry Number
|
if(isset($output[0])) { //Found a valid-looking Enquiry Number
|
||||||
$fetched_enquirynumber = $output[0];
|
$fetched_enquirynumber = $output[0];
|
||||||
$enquiry = $this->Enquiry->findByTitle($fetched_enquirynumber);
|
$enquiry = $this->Enquiry->findByTitle($fetched_enquirynumber);
|
||||||
if($enquiry['Enquiry']['id'] == NULL) { //It passes the Regex - but we don't find an Enquiry for it in the MER.
|
if($enquiry) {
|
||||||
if($testing == 0) { //testing mode == 1, production == 0.
|
return $enquiry;
|
||||||
imap_mail_move($mbox, $i, 'INBOX/Discarded'); //Discard it.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return $enquiry; // Valid Enquiry if we've found the enquiry in the Master Enquiry Register
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue