I installed pear-mail including smtp like so
$ sudo pear install Net_SMTP
my php looks like this
$mail = @ \Mail::factory('smtp', $params);
$mail = & $mail;
$success = $mail->send($this->vchEmail, $headers, $body);
if (!$success) {
throw new Exception(' Email was not sent.');
}
if (@\PEAR::isError($mail)) {
throw new Exception(' Email was not sent: '.$mail->getMessage());
}
And it goes with no exceptions, BUT mailtrap.io does not show incoming emails.
If I send email from my local it is sent and received all right like so:
$mail = @ \Mail::factory('mail', $params);
May be the problems came when I was installing Net_SMTP. I got some WARNINGs like so:
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
WARNING: "pear/Auth_SASL" is deprecated in favor of "pear/Auth_SASL2"
Did not download optional dependencies: pear/Auth_SASL, use --alldeps to download automatically
pear/Net_SMTP can optionally use package "pear/Auth_SASL" (version >= 1.0.5)
downloading Net_SMTP-1.8.0.tgz ...
Starting to download Net_SMTP-1.8.0.tgz (14,399 bytes)
.....done: 14,399 bytes
downloading Net_Socket-1.2.2.tgz ...
Starting to download Net_Socket-1.2.2.tgz (6,903 bytes)
...done: 6,903 bytes
install ok: channel://pear.php.net/Net_Socket-1.2.2
install ok: channel://pear.php.net/Net_SMTP-1.8.0
I also checked ports availability like so:
Install Nmap $ sudo port install nmap
And check the port 25 $ nmap -p 25 smtp.mailtrap.io
here is the result
Starting Nmap 7.60 ( https://nmap.org ) at 2018-02-01 12:50 AEDT
Nmap scan report for smtp.mailtrap.io (34.197.182.80)
Host is up (0.23s latency).
Other addresses for smtp.mailtrap.io (not scanned): 52.5.224.12 34.224.48.59
rDNS record for 34.197.182.80: ec2-34-197-182-80.compute-1.amazonaws.com
PORT STATE SERVICE
25/tcp open smtp
Nmap done: 1 IP address (1 host up) scanned in 0.52 seconds
Thank you.