erik73 / addon-mail

Mail server based on Postfix, Dovecot and Postfix Admin - Home Assistant Add-on by Erik73
https://erik73.github.io
MIT License
16 stars 5 forks source link

Help needed with setup... #59

Closed tonysprenk closed 3 years ago

tonysprenk commented 3 years ago

Hi!

Thanks allot for working on and providing this addon.

I need some help with the setup. Let me explain my use case first so you can tell me if what I’m looking for is even possible: I have a small, 1 man, business that has a website (tonymaakt.nl) and I would like to run my own mail server because that way i don’t have to pay extra for mail hosting, I already have HomeAssistant running on a raspberrypi 4B.

I looked for documentation but didn’t find any. I looked at the two closed issues but couldn’t make sense of it.

What should I fill in to the addon settings (domain, hostname) and how can I setup my domain in postfix so I can send and receive email with tony@tonymaakt.nl?

Thank you very much in advance for your help!

erik73 commented 3 years ago

Hi.

There is some documentation on the Documentation tab of the addon. It is quite thin, and mostly aimed at those that have done mail server setups before.

It is not clear to me if you have any experience of setting up a mail server in general. Same basic questions: Are you familiar with MX records in DNS? Do you have control of the DNS server for your domain so that you can add records to it? Do you have a fixed IP address on your internet connection? Do you know if your ISP has any blocking in place for SMTP connections?

tonysprenk commented 3 years ago

Thanks for your quick reply. I have setup Zoho mail before which involves adding dns records etc. I have control over dns server for my domain. I’m not allowed a fixed ip but I have a dynamic DNS setup. Only port 25 is blocked by my isp.

BrendanxP commented 3 years ago

I think you have a problem not being able to forward port 25. I also got stuck at that point. You seem to be Dutch, chances are youre ISP is Ziggo. In that case you are able to forward port 25 if you put the modem in bridge mode with another router. I hope this may help you out!

tonysprenk commented 3 years ago

I think you have a problem not being able to forward port 25. I also got stuck at that point. You seem to be Dutch, chances are youre ISP is Ziggo. In that case you are able to forward port 25 if you put the modem in bridge mode with another router. I hope this may help you out!

I am Dutch! My ISP is T-Mobile (unfortunately) and they don’t allow forwarding port 25 but I read somewhere that port 465 and 587 are better to use anyway. Not sure if that’s correct.

erik73 commented 3 years ago

Ok. My ISP is blocking outgoing SMTP. That is no problem, since I can use the add-ons SMTP relay option to send outgoing emails thru thier server. If the SMTP ports for incoming mail to your server is blocked, I am not sure how to proceed.

To answer your question on how to setup the add-on:

my_hostname mail.tonymaakt.nl or tonymaakt.nl The important thing here is to understand that your MX record for tonymaakt.nl points to a hostname (an A-record). In your case your hostname can be setup as mail.tonymaakt.nl or tonymaakt.nl. It depends how you have your A-record configured.

domain_name tonymaakt.nl

admin_user admin

admin_password xxxx

In the case above you login to the web interface as: Username: admin@tonymaakt.nl Password: xxxx

tonysprenk commented 3 years ago

Thanks very much for the help. I think I have it setup properly but when is send an email from the postfix webUI it does not arrive. First I sent one to an @icloud.com e-mail adres and in the logs it says that mail from my IP is rejected due to it being listed in spamhaus.org. When I sen an email to a @gmail.com account it says in the logs that it was sent ok but I did not receive the email. Any thoughts would be greatly appreciated.

tonysprenk commented 3 years ago

Also I’m not 100% sure I have the MX stuf setup properly. This is what it looks like: C29657DB-3059-452F-A4D6-B36FAB443097

erik73 commented 3 years ago

Thanks very much for the help. I think I have it setup properly but when is send an email from the postfix webUI it does not arrive. First I sent one to an @icloud.com e-mail adres and in the logs it says that mail from my IP is rejected due to it being listed in spamhaus.org. When I sen an email to a @gmail.com account it says in the logs that it was sent ok but I did not receive the email. Any thoughts would be greatly appreciated.

Google and others do a lot of checks on the servers that send mail to them. It is almost impossible to be able to send to them without using your providers smtp relay host. There is an option for this in the add-on config options. All providers I have had offers a SMTP relay host. I made a search for T-Mobile smtp in google. smtp.gprs.t-mobile.nl showed up. Try that as smtp relay host.

erik73 commented 3 years ago

Also I’m not 100% sure I have the MX stuf setup properly. This is what it looks like: C29657DB-3059-452F-A4D6-B36FAB443097

I did a quick lookup of your mail domain: Hostname IP Address tonymaakt.hopto.org 82.174.37.206

It looks OK!

This means you have to set your hostname in the add-on config to: tonymaakt.hopto.org That is the name that your postfix server instance we present itself with, and it has to match the hostname in the add-on config.

You also have to do port forwarding in your router for the smtp ports to your Home Assistant IP.

tonysprenk commented 3 years ago

Thanks for the very helpful answers. I got everything to work but: when I send an email I immediately get an email back from mail delivery system stating the access is denied for the smtp relay host. when I try to send without the relay host I get a response from Spamhaus saying my IP address is blocked. I have requested a removal of my IP address at Spamhaus but I suspect it will be denied because I have a dynamic IP. Any suggestions would be greatly appreciated.

tonysprenk commented 3 years ago

seems to be working now without relay host. I guess Spamhaus accepted my request. Let's see how long it will last.

tonysprenk commented 3 years ago

Hmmm maybe is spoke too soon. Sending an email to an iCloud account works but to a gmail account doesn't. the email doesn't arrive but im not getting any errors or mail delivery messages. any suggestions for a more robust solution would be greatly appreciated.

erik73 commented 3 years ago

I think your only option is to find a relay server for your provider. The one I listed was the one I found, but perhaps you can find another server. Understanding Dutch will probably make it easier, since many search results was not understandable for me. Some providers may require SMTP authentication, but I have not implemented that function in the add-on. I can work on that if you need it. It should not be that hard to implement that.

Here is a link with some information on the subject: https://www.cyberciti.biz/faq/postfix-smtp-authentication-for-mail-servers/

tonysprenk commented 3 years ago

Yes I've now found out that my provider doesn't have a SMTP relay host. I'm now trying to setup a SendGrid SMTP relay. It would be VERY helpful to have SMTP authentication built in to your add-on. Thanks allot for all the help!

erik73 commented 3 years ago

I found some more information: https://www.linode.com/docs/guides/postfix-smtp-debian7/ https://sendgrid.com/docs/for-developers/sending-email/postfix/

Do you want me to try and setup config options for this? Perhaps you can try them out for me?

tonysprenk commented 3 years ago

Yes sendgrid or even better sendinblue integration would be very much appreciated. I will gladly test it out!

tonysprenk commented 3 years ago

Probably just having smtp authentication would be easiest? That would be enough to integrate sendinblue which has the highest outgoing email limit on the free plan (300 per day).

erik73 commented 3 years ago

Hi again @tonysprenk . I have now released a new version of the add-on with the ability to use authentication on relay servers. I also updated the documentation with instructions on how to enable it. Please try it out!

tonysprenk commented 3 years ago

Wow great work! Maybe a dumb question but how can I update the addon without losing my setup? I have auto update enabled.

erik73 commented 3 years ago

Yes.

Just update it. Nothing will be lost. That only happens when you delete the add-on.

You can reload in the add-on store and the update should be available right now. Perhaps you need to turn on advanced mode in your HA user setting to see that option in the top right (the three dots) in the Supervisor add-on store tab.

Skickat från min iPhone

12 apr. 2021 kl. 21:31 skrev tonysprenk @.***>:

 Wow great work! Maybe a dumb question but how can I update the addon without losing my setup? I have auto update enabled.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

tonysprenk commented 3 years ago

Everything is working as expected! Thank you very much for the great work. Closing this issue but if need more help I know where to be. Thanks again for everything!