fkasler/phishmonger

SMTP mail received but not sent

Closed this issue · 5 comments

Fishmonger was installed using Flik.
I am getting an error when I try to send mail from Phishmonger (any ideas).
When I try the 'Send Test' email option I get the error below in the web console:

connect ECONNREFUSED <ipaddressofserver>:25
Closing connection to the server using "destroy"
Send Error: connect ECONNREFUSED <ipaddressofserver>:25

In the node console I get the following:
{"name":"SMTP","hostname":"<servername>","pid":3726,"level":20,"component":"mail","tnx":"transport","version":"6.7.5[client:6.7.5]","action":"send","msg":"Sending mail using SMTP/6.7.5[client:6.7.5]","time":"2022-05-13T12:50:08.023Z","v":0} {"level":30,"time":1652446208024,"pid":3726,"hostname":"<servername>","reqId":"req-2","res":{"statusCode":200},"responseTime":6.7292500007897615,"msg":"request completed"} {"name":"nodemailer","hostname":"<servername>","pid":3726,"level":20,"component":"smtp-connection","sid":"ZdvYcg3UFQI","tnx":"dns","source":"serverfqdn","resolved":"<ipaddress>","cached":true,"msg":"Resolved <servername> as <ipaddress> [cache hit]","time":"2022-05-13T12:50:08.025Z","v":0} {"name":"nodemailer","hostname":"<servername>","pid":3726,"level":50,"component":"smtp-connection","sid":"ZdvYcg3UFQI","msg":"connect ECONNREFUSED <ipaddress>:25","time":"2022-05-13T12:50:08.025Z","v":0} {"name":"nodemailer","hostname":"<servername>","pid":3726,"level":20,"component":"smtp-connection","sid":"ZdvYcg3UFQI","tnx":"smtp","msg":"Closing connection to the server using \"destroy\"","time":"2022-05-13T12:50:08.026Z","v":0} {"name":"nodemailer","hostname":"<servername>","pid":3726,"level":50,"component":"mail","err":{"errno":"ECONNREFUSED","code":"ESOCKET","syscall":"connect","address":"<ipaddress>","port":25,"command":"CONN"},"tnx":"transport","action":"send","msg":"Send Error: connect ECONNREFUSED <ipaddress>:25","time":"2022-05-13T12:50:08.026Z","v":0}

Based on the output, I would assume either the mail server you are sending to is blocking your TCP connection, or you are being blocked by a firewall. Do you own your server? Or is it hosted? If hosted, have you reviewed their policies regarding SMTP? Some providers require business tier subscriptions to send outbound SMTP.

Thanks for the reply, yes you are correct, looking into this further it appears the hosted server provider is blocking ports 25 and 465 even though firewall rules are allowing these. I will have to find an alternative hosting provider.

Closing as issue appears to be with hosting not related to Phishmonger.

My host does not appear to block smtp (tested with port quiz and connection are established). This is very likely down to my configuration but these are the steps I have done so far - any help on the workflow or missing config would really help:

My understanding is Phishmonger can be used as a standalone SMTP server (so I don't need Mailgun etc.)

Installed using FLIK - Phishmonger and then Humble Chameleon
Using the capture email button I am able to send an email to use as a template.
When I complete the details in the right hand panel (apart from SMTP From, Mail Server and Username and Password ) - I 'think' these are if I use a 3rd party SMTP service?
Click Send Test - Email fails with
connect ECONNREFUSED 127.0.0.1:25 Closing connection to the server using "destroy" Send Error: connect ECONNREFUSED 127.0.0.1:25

I am guessing that all the humble Chameleon parts are include in the Phishmoger index.js so there is nothing to run for this?

Can you advise on the above any sections I am missing to be able to send emails out?

Thanks for any help.

You should set the "Mail Server" option to the MX of the domain of your recipients. The error above looks like you set it to localhost? Or maybe it defaulted to that if you didn't fill it out. Phishmonger is indeed a mail server itself, but keep in mind that in order to deliver emails, Phishmonger must talk to some other mail server: Either directly to the destination mail infrastructure (usually the MX records, but not always ;-) ) or to a 3rd party server as a relay.

You also need to specify an SMTP FROM, which is used in the "MAIL FROM:" SMTP command.

If you are using a 3rd party server to relay messages, that is when you would check the secure email box, and provide a username and password. Otherwise, Phishmonger directly sends SMTP commands and DATA to the "Mail Server" specified.

Finally, please note that using port quiz to check an outbound TCP connection only lets you know if it is possible to complete a TCP handshake. You could still bump into issues with a firewall that does application layer filtering. Therefore, I would also generally recommend performing an additional diagnostic of using telnet or netcat to connect to a test SMTP server and manually send an email using "EHLO", "MAIL FROM:", "RCPT TO:", and "DATA" commands.