Changeset 15 for Common/Mail.php
- Timestamp:
- Dec 27, 2022, 3:11:01 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Mail.php
r14 r15 20 20 private array $Priorities; 21 21 private string $Boundary; 22 public bool $TestMode; 22 23 23 24 function __construct() … … 26 27 $this->Boundary = md5(date('r', time())); 27 28 $this->AgentIdent = 'PHP/Mail'; 29 $this->TestMode = false; 28 30 $this->Clear(); 29 31 } … … 133 135 if ($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent; 134 136 if ($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo; 135 if ($this->From != '') $this->Headers['From'] = $this->From; 137 if ($this->From != '') 138 { 139 $IndexStart = strpos($this->From, '<'); 140 if ($IndexStart !== false) 141 { 142 $this->Headers['From'] = '=?utf-8?Q?'.quoted_printable_encode(trim(substr($this->From, 0, $IndexStart))).'?= '.substr($this->From, $IndexStart); 143 } else 144 { 145 $this->Headers['From'] = $this->From; 146 } 147 } 136 148 137 149 $Headers = ''; … … 145 157 if ($this->Subject == '') throw new Exception(T('Mail message missing Subject')); 146 158 147 $res = mail($To, $this->Subject, $Body, $Headers); 159 if ($this->TestMode) 160 { 161 echo('to: '.$To.', subject: '.$this->Subject.', body: '.$Body.', headers: '.$Headers); 162 $res = true; 163 } else 164 { 165 $res = mail($To, $this->Subject, $Body, $Headers); 166 } 148 167 return $res; 149 168 }
Note:
See TracChangeset
for help on using the changeset viewer.