Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sending email #17

Closed
jojo05 opened this issue Nov 12, 2016 · 8 comments
Closed

sending email #17

jojo05 opened this issue Nov 12, 2016 · 8 comments

Comments

@jojo05
Copy link

jojo05 commented Nov 12, 2016

What solution would you use/propose for sending email ? (I understand that go-guerrilla is only for receiving emails).

I would like to adapt go-guerrilla to build my own webmail. Wouldn't be ok for the local smtp client to talk to this server?
thanks

@flashmob
Copy link
Owner

flashmob commented Nov 12, 2016

For sending email, it's much more tricky since there's a lot of moving parts such as DKIM, SPF, feedback loops, IP address reputation and more. Perhaps a cloud offering such as mailgun.com or mandrill.com could be used, or you could DIY and configure an instance of postfix if you are familar with setting all that up.

We are currently refactoring the server to be more modular so that it would be easier to add new features in the future.

@jojo05
Copy link
Author

jojo05 commented Nov 13, 2016

Is Postfix better than Exim? (I've used Exim in the past and it's slightly complicated).
Thanks

@jojo05
Copy link
Author

jojo05 commented Nov 13, 2016

@flashmob
Copy link
Owner

flashmob commented Nov 14, 2016

This is how email is sent on Guerrilla Mail:

For DKIM key generation, the dkim tools package is very useful:

apt install opendkim-tools

and then the following command to generate the keys:

opendkim-genkey -r -b 2048 -d guerrillamail.com -s selector_name --hash-algorithms=sha256 --directory=/path/to/somewhere

(Where selector_name can be any name you choose)

Then the DNS is updated with the public key, the private key is used for signing. You only need to do this once every year or so. Also the SPF is also set in the DNS records, no need to use any other tools / programs.

Guerrilla Mail has all the DKIM and SPF admin procedure fully automated.

As for sending, a Go program is used to read messages from a queue and schedule them for sending. To do the actual sending, the Go program executes a legacy PHP script through a FastCGI backend ( https://github.com/flashmob/go-fastcgi-client ). The PHP does the signing, reads the MX records, chooses the best MX server and uses https://github.com/PHPMailer/PHPMailer to do the actual sending and returns the result to the Go program...

The packages you have linked to are mostly for validating DKIM / SPF, but validation is only used for spam filtering, we just have to sign the message with our key when sending and make sure that our SPF and DMARC records are configured + any other administrative tasks.

@jojo05
Copy link
Author

jojo05 commented Nov 14, 2016

Thanks, this is very useful.

For a webmail solution, where I get messages I care about, I would need to filter spam (on the received messages) using DMARC (DKIM+SPF), that's why I thought I would need the validating libs.

@flashmob
Copy link
Owner

flashmob commented Nov 14, 2016

Welcome, Thanks for asking.
A quick way to setup a spam filter would be to
apt-get install spamassassin spamc

/etc/init.d/spamassassin restart
and then do something like in this example: https://github.com/saintienn/go-spamc

@aftabnaveed
Copy link

I know this issue is closed, but I am just wondering why would you need "Go" to process the output of PHP script (that is used to send emails via PHPMailer like mentioned above)?

@flashmob
Copy link
Owner

flashmob commented Sep 4, 2017

Go program just needs to get the result to see if the send was successful. Of course, you do not need to use Go for that - there are many ways to skin a cat. This is really a Producer–consumer problem, whatever way you use to solve it should be fine :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants