Changeset 396 for trunk/global.php
- Timestamp:
- Mar 3, 2012, 9:12:26 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/global.php
r392 r396 108 108 } 109 109 110 function AddEmailToQueue($Address, $Subject, $Content, $Headers = '') 111 { 112 $this->Database->insert('EmailQueue', array('Address' => $Address, 'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()', 'Headers' => $Headers)); 113 } 114 115 function MailUTF8($To, $Subject = '(No subject)', $Message = '', $Header = '') 116 { 117 $Header = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n".$Header; 118 mail($To, '=?UTF-8?B?'.base64_encode($Subject).'?=', $Message, $Header); 119 //echo('mail('.$To.', =?UTF-8?B?'.base64_encode($Subject).'?=, '.$Message.', '.$Header.')<br/>'); 120 } 121 110 function AddEmailToQueue($To, $Subject, $Content, $From, $AttachmentFileId = '') 111 { 112 $Values = array('Address' => $To, 113 'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()', 114 'From' => $From); 115 if($AttachmentFileId != '') $Values['AttachmentFile'] = $AttachmentFileId; 116 $this->Database->insert('EmailQueue', $Values); 117 } 118 122 119 function ProcessEmailQueue() 123 120 { 121 $Mail = new Mail(); 124 122 $Output = ''; 125 123 $DbResult = $this->Database->select('EmailQueue', '*', 'Archive=0'); 126 124 while($DbRow = $DbResult->fetch_assoc()) 127 125 { 128 $this->MailUTF8($DbRow['Address'], $DbRow['Subject'], $DbRow['Content'], $DbRow['Headers']); 129 //echo('mail('.$DbRow['Address'].', '.$DbRow['Subject'].', '.$DbRow['Content'].', FromUTF8('.$DbRow['Headers'].', \'iso2\'));'); 126 $Mail->AddTo($DbRow['To']); 127 $Mail->Subject = $DbRow['Subject']; 128 $Mail->From = $DbRow['From']; 129 $Mail->AddBody(strip_tags($DbRow['Content']), 'text/plain'); 130 $Mail->AddBody($DbRow['Content'], 'text/html'); 131 if($DbRow['AttachmentFile'] != 'NULL') 132 { 133 $DbResult2 = $this->Dataase->select('File', '*', 'Id='.$DbRow['AttachmentFile']); 134 $File = $DbResult2->fetch_assoc(); 135 $Mail->AttachFile($this->Config['Web']['FileRootFolder'].$File['DrivePath'], $File['MimeType']); 136 } 137 $Mail->Send(); 130 138 $this->Database->update('EmailQueue', 'Id='.$DbRow['Id'], array('Archive' => 1)); 131 139 $this->Modules['Log']->NewRecord('System', 'SendEmail', $DbRow['Id']); … … 209 217 $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 210 218 211 $Mail = new Mail();212 213 219 $System = new System(); 214 220 $System->Config = $Config;
Note:
See TracChangeset
for help on using the changeset viewer.