I configured my email settings to connect to sendgrid on port 587 and use tsl:
Code:
$config["useragent"] = "CodeIgniter";
$config["protocol"] = "smtp"; // or mail or sendmail
$config["mailpath"] = "/usr/sbin/sendmail";
$config["smtp_host"] = "smtp.sendgrid.net";
$config["smtp_user"] = "apikey";
$config["smtp_pass"] = "<SENDGRID-API-KEY-HERE>";
$config["smtp_port"] = 587;
$config["smtp_crypto"] = "tsl";
$config["dsn"] = FALSE;
// ETC
I wrote a short script on a controller:
Code:
public function mailtest()
{
$this->load->library('email');
$this->email->from('[email protected]', $this->config->item("site_name"));
$this->email->to('[email protected]');
$this->email->subject('Email Test ' . microtime(TRUE));
$this->email->message('Testing email config with new port');
$this->email->send(FALSE);
header("content-type: text");
echo ($this->email->print_debugger());
die("done");
}
When I look at the output of print_debugger(), I don't see any STARTTLS command:
Code:
220 SG ESMTP service ready at ismtpd0003p1sjc2.sendgrid.net
<br /><pre>hello: 250-smtp.sendgrid.net
250-8BITMIME
250-PIPELINING
250-SIZE 31457280
250-STARTTLS
250-AUTH PLAIN LOGIN
250 AUTH=PLAIN LOGIN
</pre><pre>from: 250 Sender address accepted
</pre><pre>to: 250 Recipient address accepted
</pre><pre>data: 354 Continue
</pre>250 Ok: queued as tegwA0rzQKWW-zhM2QCUYg
<br /><pre>quit: 221 See you later
</pre>Your message has been successfully sent using the following protocol: smtp<br /><pre>Date: Thu, 23 Mar 2017 17:57:40 -0700
From: "sneakyimp workstation" <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?UTF-8?Q?Email=20Test=20149031706?==?UTF-8?Q?0.8739?=
Reply-To: <[email protected]>
User-Agent: CodeIgniter
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Testing email config with new port
</pre>
Is the server output truncated or something? How can I be sure that my server's interactions with the SMTP gateway are encrypted?