60 $this->server = ini_get(
"SMTP");
61 $this->port = ini_get(
"smtp_port");
79 $fp = fopen($debugPath . DIRECTORY_SEPARATOR . $this->
to,
'a');
82 trace(
"Mail: unable to open debug log file in $debugPath name {$this->to}", 3);
86 $rtn = fwrite($fp,
"From: $this->from\n".
89 "Subject: $this->subject\n".
95 trace(
"Mail: unable to write to debug log file in $debugPath name {$this->to}", 3);
106 # connect to the smtp server
107 if(!$smtp->connect($this->server, $this->smtp_port))
109 die (
"Error: " . $smtp->error[
"error"] .
"\n");
112 # say hello so we all know who we are
120 if (!$smtp->Authenticate(
$username, $password))
122 $err = $smtp->error[
"error"];
123 trace(
"SMTP Authentication failed: $err", 1);
129 # start the mail transaction with with the return path address
130 $smtp->Mail($this->
from);
132 if ($smtp->error) trace(
"FROM: ".print_r($smtp->error,
true), 2);
134 # state each recipient
135 # NOTE: this does _not_ add to: or cc: headers to the email
136 $smtp->Recipient($this->
to);
139 if ($smtp->error) trace(
"RCPT: ".print_r($smtp->error,
true), 2);
141 if (!$this->fullFrom) $this->fullFrom =
$this->from;
143 # send the message including headers (headers must be followed by an
145 $data =
"From: $this->fullFrom\n".
148 "Subject: $this->subject\n".
154 if ($smtp->error) trace(print_r($smtp->error,
true), 2);
156 # the mail either been sent or failed either way we are done
FakoliException is the base exception class for all Fakoli errors.
Mail($from, $to, $subject, $body="", $headers="", $fullFrom="")
static getValue($component, $name)
Retrieve the value of the specified Setting.