mailhog / MailHog

Web and API based SMTP testing
MIT License
14.08k stars 1.07k forks source link

Offer sendmail replacement #45

Closed eelkeblok closed 9 years ago

eelkeblok commented 9 years ago

I was looking into mailhog, but my application uses sendmail to send its mail. Any chance of adding a drop-in replacement for sendmail that would instead send its messages to mailhog? Or is this already possible and am I missing something (I am aware of the possibility of configuring sendmail to use smtp, but that seems quite involved and ultimately a roundabout way of getting an email from a command line utility into mailhog).

ian-kent commented 9 years ago

It's possible, but sendmail has a lot of command line options - are you just after the basic use-case of piping SMTP content via STDIN?

If it's just that, it should be fairly trivial to implement (ignoring the problem of discovering the running MailHog instance)

eelkeblok commented 9 years ago

Yup, that's it. I have an application that assumes it can use sendmail to send emails. It has you configure a command line that lets it send email contents.

revolutionate commented 9 years ago

For PHP this would be very useful - otherwise you need to run e.g. sSMTP as well. MailCatcher already does it via its catchmail command, by the way.

ian-kent commented 9 years ago

How about this? https://github.com/mailhog/mhsendmail

:smile:

thaJeztah commented 9 years ago

Nice! Will there be a binary distribution of that as well? Could be as part of the MailHog Docker image

thaJeztah commented 9 years ago

LOL, missed the release notes :+1:

csiszarattila commented 9 years ago

Can you explain how i can use mhsendmail from the binary distribution? Like for php's sendmail_path?

ian-kent commented 9 years ago

Can you explain how i can use mhsendmail from the binary distribution?

You'll need to download the mhsendmail binary from the releases page.

Once you've done that, it should be a simple drop-in replacement for sendmail - although the command line flags will be slightly different. A brief overview is on the mhsendmail readme.

When I get a chance I'll add some info to the MailHog docs and (hopefully) also make it part of the MailHog binary.

csiszarattila commented 9 years ago

Thanks! I somehow missed that the mhsendmail released in a separated binary.

eelkeblok commented 9 years ago

Awesome. Thanks a lot.