I'm looking to record the SMTP transaction for each sent email in laravel 4.1.
For example when I use the following code to send an email:
Mail::send('emails.any_view', $data, function($message) use ($user) {
$message->from('[email protected]', 'PHP Code');
}
I would like to see something like:
[Resolving gmail-smtp-in.l.google.com...]
[Contacting gmail-smtp-in.l.google.com [173.194.64.27]...]
[Connected]
220 mx.google.com ESMTP zd4si6046704obb.40 - gsmtp
EHLO Network-Tools.com
250-mx.google.com at your service, [67.222.132.193]
VRFY test
252 2.1.5 Send some mail, I'll try my best zd4si6046704obb.40 - gsmtp
RSET
250 2.1.5 Flushed zd4si6046704obb.40 - gsmtp
EXPN test
502 5.5.1 Unimplemented command. zd4si6046704obb.40 - gsmtp
RSET
250 2.1.5 Flushed zd4si6046704obb.40 - gsmtp
MAIL FROM:<[email protected]>
250 2.1.0 OK zd4si6046704obb.40 - gsmtp
RCPT TO:<[email protected]>
550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 zd4si6046704obb.40 - gsmtp
[Address has been rejected]
RSET
250 2.1.5 Flushed zd4si6046704obb.40 - gsmtp
QUIT
221 2.0.0 closing connection zd4si6046704obb.40 - gsmtp
[Connection closed]
I don't really care if this is in a log file or variable I can just dump when I need to. does anyone know how I can access this information?
I think I'm getting closer to my answer. If I replace the encription in app/config/mail.php to something invalid I get an error message like:
Swift_TransportException Expected response code 220 but got code "500", with message "500 5.5.1 Unknown or unimplemented command "
I need a way of accessing the response codes even when they do not create an error.