tweedegolf / mailcrab

Email test server for development, written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sendmail client

pquerner opened this issue · comments

In PHP I've used https://github.com/mailhog/mhsendmail so I could use PHP to talk to a SMTP server (in this instance MailHog):

SMTP = mailhog
smtp_port = 1025
sendmail_path = '/usr/bin/mhsendmail --smtp-addr="mailhog:1025"'

(php.ini)

Is that something that should work just the same (Note: I have not tried yet) with mailcrab or should that part also be rewritten in Rust?

Thanks!

// Meanwhile I tried this setup but replaced "mailhog" with "mailcrab" (both listen on the 1025 port) but it didnt work out of the box. Not sure where to look now.

MailCrab should work with https://github.com/mailhog/mhsendmail out of the box. mhsendmail is just a CLI wrapper for sending email to localhost:1025 (by default). So please try it out and let me know :-)

Mh, doesnt work with the sendmail wrapper. I get no error message.
Works only if I patch my system to use SMTP directly (default is sendmail).

Are you running MailCrab on localhost? Than you should configure ‘mhsendmail’ on ‘localhost:1025’ instead of the hostname ‘mailcrab’

Mailcrab is running in a Docker container. I've linked MailCrab to my PHPFPM container (like I did with mailhog).
Instead of Port 1080 I use 8025 for the frontend, 1025 stayed the same. With this setup (and patching so SMTP is used instead of Sendmail) it works, although it would be nice if sendmail worked out of the box.

So my php.ini looks like above, but instead of "mailhog" I wrote "mailcrab" (my service name).
Inside the PHP container I installed "ping" and can successfully reach "mailcrab", so I think "they can see eachother" just fine. (Which is proven again by SMTP)

Maybe "mhsendmail" receives data in a different format?

If I startup MailCrab using:

docker run --rm -p 1080:1080 -p 1025:1025 marlonb/mailcrab:latest

And send a test email using:

mhsendmail test@example.com <<EOF
From: App <app@example.com>
To: Test <test@example.com>
Subject: Test message

Some content!
EOF

The email appears in de MailCrab inbox, so this should work.

If you are using a docker-compose.yml, I might be able to help you with the configuration.

You are right, it works if I just use the mail function. Then its something in-between. :/

Well I guess time to close this topic, as its not a issue with mailcrab. :)

Thanks for listening and commenting!