Send mail to local server from hotmail, gmail, etc.

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-27 08:22

Hi. Hope everything is good.


In hmailserver I have created a domain called lollipop.se, and two user accounts ("user1" and "user2").

I tried to send mail to one of the user accounts that I created, and to do this I used mail() function in php which worked fine.
In the headers I wrote: to "user1@lollipop.se", from "user2@lollipop.se" ...


Then I tried to this through hotmail. I sent a mail to: "user1@mypublicipaddress".
I do not receive any error messages from hotmail, but the message does not come into my inbox on the mail server.


I have forwarded port to 25, and I have previously forwarded to 80 for a web server that works on the same machine.


Best regards
Neo

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-27 18:43

Would really appreciate if i could get some help here...

palinka
Senior user
Senior user
Posts: 1100
Joined: 2017-09-12 17:57

Re: Send mail to local server from hotmail, gmail, etc.

Post by palinka » 2019-08-27 18:53

Did you run the internal diagnostics in the admin console?

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-27 19:02

Start by reviewing documentation on MX records to understand that you cannot address an email to @mypublicipaddress.

This is a decent explaination: https://practical365.com/exchange-server/mx-record/

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 01:36

Thanks for the replays.

Mikedibella...

Why does it look up MX record if domain is not provided? In my case the ip is used instead of the domain. I mean if I use my ip in the webbrowser it doesn't make a dns lookup, and everything works fine.

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-28 01:58

That just the way email routing works. The right-hand side of an email address is not the address of the server that handle mail for that user, so you can't just place an ip address there and expect mail to be directed to a server at that address.

Instead, the mail transfer agent (MTA) will use the right-hand side of the email address to lookup a type of record in DNS called the mail exchanger, or MX, record, to get the hostname of the server that handle mail for all users with the same right-hand side, or domain, in their address.

That hostname is then resolved via DNS to an ip address that the MTA connects to in delivering the mail.

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 18:02

Okey.

So if I write mail to user@lollipop.se and if I want to receive the mail on my ip, I need to write my ip as mx record in the dns settings for lollipop.se?

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-28 18:47

Using the DNS management tools for your domain, create an MX record for lollipop.se making mail.lollipop.se your mail exchanger with priority 10. Then create an A record for mail.lollipop.se that points to your public IP address. Use mail.lollipop.se as your hMailServer hostname.

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 22:03

domain settings:

Name: almighty.se, type: MX, Data: mail.almighty.se, Prio: 10, TTL 86400
Name: almighty.se, type: A, Data: "mypublicip", Prio: 0, TTL 3600
Name: www.almighty.se, type: A, Data: "mypublicip", Prio: 0, TTL 3600


hmailserver(smtp) settings:

local host name: mail.almighty.se
remote host name: mail.almighty.se


Http request to almighty.se works, but mail still does not work. :/

User avatar
jimimaseye
Moderator
Moderator
Posts: 8125
Joined: 2011-09-08 17:48

Re: Send mail to local server from hotmail, gmail, etc.

Post by jimimaseye » 2019-08-28 22:13

qneo wrote:
2019-08-28 22:03
domain settings:

Name: almighty.se, type: MX, Data: mail.almighty.se,Prio: 10, TTL 86400
Name: almighty.se, type: A, Data: "mypublicip", Prio: 0, TTL 3600
Name: www.almighty.se, type: A, Data: "mypublicip", Prio: 0, TTL 3600


hmailserver(smtp) settings:

local host name: mail.almighty.se
remote host name: mail.almighty.se


Http request to almighty.se works, but mail still does not work. :/
Where does mail.almighty.se point to? Currently nowhere. Hence failure.

[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 22:24

Okay.

So how do I create an A record and associate it with mail.almighty.se.
Or how should it be done?

User avatar
jimimaseye
Moderator
Moderator
Posts: 8125
Joined: 2011-09-08 17:48

Re: Send mail to local server from hotmail, gmail, etc.

Post by jimimaseye » 2019-08-28 22:44

Create one the same way as you have created the A record for almighty.se.

[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-28 22:46

The data for the A record is you dotted IP address: 81.225.141.114

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 23:13

the ip you wrote is the one I have instead of where I wrote "mypublicip".

so the setup is already correct, right?

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-28 23:18

You are missing

Code: Select all

Name: mail.almighty.se, type: A, Data: "mypublicip", Prio: 0, TTL 3600

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 23:39

I tried that to now, doesn't work. I dont think that matters because the settings for another domain that works looks like this:

Name: awebsite.se, type: MX, Data: mail1.beebyte.se,Prio: 10, TTL 86400
Name: awebsite.se, type: A, Data: "185.133.206.78", Prio: 0, TTL 3600
Name: www.awebsite.se, type: A, Data: "185.133.206.78", Prio: 0, TTL 3600


It works for both mail and web.


Could it be because of port 25? I read somewhere that it may be blocked due to ISP

User avatar
jimimaseye
Moderator
Moderator
Posts: 8125
Joined: 2011-09-08 17:48

Re: Send mail to local server from hotmail, gmail, etc.

Post by jimimaseye » 2019-08-28 23:45

qneo wrote:
2019-08-28 23:39
I tried that to now, doesn't work. I dont think that matters
Well, you know best. We are all sorry for wasting your time.

[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-28 23:49

Actually, I dont know. Thats why I'm here and asking :)

User avatar
jimimaseye
Moderator
Moderator
Posts: 8125
Joined: 2011-09-08 17:48

Re: Send mail to local server from hotmail, gmail, etc.

Post by jimimaseye » 2019-08-28 23:54

So do as you have been advised to do.

[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-28 23:54

it may be blocked due to ISP
Possibly. Your IP addresses, 81.225.141.114, is listed in the block list dul.dnsbl.sorbs.net as a known dynamic IP address. This type of address often has port restrictions imposed by the ISP.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8125
Joined: 2011-09-08 17:48

Re: Send mail to local server from hotmail, gmail, etc.

Post by jimimaseye » 2019-08-28 23:57

Port 25 is usually blocked outbound (to stop you running a mail server and sending mail).

Currently, mx records point to a non existent address.

[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-29 00:01

jimimaseye

Didn't I write that I had tried the advise as well?


This is the record I created.
Name:mail.almighty.se type:A data:81.225.141.114 prio: 0 tll:3600

Still not working.

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-29 00:19

Your DNS records are correct now:

Code: Select all

Non-authoritative answer:
almighty.se     MX preference = 10, mail exchanger = mail.almighty.se

mail.almighty.se        internet address = 81.225.141.114
So consider port 25 might be blocked.

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-29 00:27

Can I change the port to something else, and add the port in the dns settings?

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-29 01:04

That's where is gets tricky. You can configure hMailServer to receive mail on another port, but you cannot control what port remote servers send mail to you on. By standard, remote servers will send to you on port 25. So even if you change the port you receive on to a different port, you will still not receive mail.

You can look at services for email forwarding (google "email forwarding services"), which receive mail for you on port 25 and then relay that mail to you on another port you select.

If you choose to use a forwarding service, you will have to change your MX record to point to the service's servers, not your own. Just keep the A record, and use that hostname in service's configuration for the target mail server. Remember to add the custom receive port in hMailServer configuration under Settings > Advanced > TCP/IP Ports as an SMTP port.

qneo
New user
New user
Posts: 29
Joined: 2019-08-27 07:59

Re: Send mail to local server from hotmail, gmail, etc.

Post by qneo » 2019-08-29 03:06

Mikedibella, thanks for the reply.

Then I guess I have to consider email forwarding if my isp doesn't have another solution.

But shuldn't I be able to receive mail if the blocking is only outbound?

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-29 05:10

It appears you have an inbound block on port 25.

You may also have an outbound block on port 25. You won't know until you try to send mail.

If you have an outbound block you will also need an outbound smart relay (google "outbound email relay service providers") so to can submit outgoing mail on a port other than 25 and have it delivered to your recipient on port 25.

Even if you don't have an outbound block, the fact that your IP address is listed on the dynamic address list will mean most servers will reject your connection attempts, so you should look at relay service anyway.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8125
Joined: 2011-09-08 17:48

Re: Send mail to local server from hotmail, gmail, etc.

Post by jimimaseye » 2019-08-29 08:54

qneo wrote:
2019-08-29 03:06
But shuldn't I be able to receive mail if the blocking is only outbound?
I said its is usually only outbound but I have known that inbound was blocked too (libero in Italy block inbound too). So you might be blocked (as rare as it is).
mikedibella wrote:
2019-08-29 05:10
Even if you don't have an outbound block, the fact that your IP address is listed on the dynamic address list will mean most servers will reject your connection attempts, so you should look at relay service anyway.
+ 1
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

palinka
Senior user
Senior user
Posts: 1100
Joined: 2017-09-12 17:57

Re: Send mail to local server from hotmail, gmail, etc.

Post by palinka » 2019-08-29 12:50

Kind of OT, but another advantage of a relay service is that they vigorously defend their sender reputation, and by extension yours as well. So there's a lot less time and worry about accidentally ending up on blacklists.

I don't have a choice because I'm on a residential ip, but i know a guy who runs a very successful hobby website discussion forum. He is constantly fighting for his sender reputation. The forum is very active and his outgoing mail volume is HIGH - lots of notifications and that sort of thing. He was complaining about all the time spent chasing down blacklists. All it takes is one user complaint sometimes. I told him to look into a relay service but at his volume, it's $$$$ he doesn't want to spend. Ok. More time chasing spam complaints, less time fishing. Up to you, bud.

User avatar
SorenR
Senior user
Senior user
Posts: 3184
Joined: 2006-08-21 15:38
Location: Denmark

Re: Send mail to local server from hotmail, gmail, etc.

Post by SorenR » 2019-08-31 11:02

mikedibella wrote:
2019-08-28 01:58
That just the way email routing works. The right-hand side of an email address is not the address of the server that handle mail for that user, so you can't just place an ip address there and expect mail to be directed to a server at that address.
Really ?? How do you think people sent mail before DNS was invented? You need to re-read the RFC's.

Wile.E.Coyote@10.10.10.10 is a perfectly acceptable mail address.

Create an entry in "Names" with your public IP address as an alias for your domain and use GMail to send a test message. QED.
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

User avatar
SorenR
Senior user
Senior user
Posts: 3184
Joined: 2006-08-21 15:38
Location: Denmark

Re: Send mail to local server from hotmail, gmail, etc.

Post by SorenR » 2019-08-31 11:51

SorenR wrote:
2019-08-31 11:02
mikedibella wrote:
2019-08-28 01:58
That just the way email routing works. The right-hand side of an email address is not the address of the server that handle mail for that user, so you can't just place an ip address there and expect mail to be directed to a server at that address.
Really ?? How do you think people sent mail before DNS was invented? You need to re-read the RFC's.

Wile.E.Coyote@10.10.10.10 is a perfectly acceptable mail address.

Create an entry in "Names" with your public IP address as an alias for your domain and use GMail to send a test message. QED.
I can add to this that every domain *SHOULD* have 2 alternative names.

Domain: acme.inc
Alias #1: FQDN of server, example: mx.acme.inc
Alias #2: Public IP address

This does not change the fact that HELO/EHLO greetings *SHOULD* contain the FQDN or Address Literal *) of the server.

*) Address Literal = IP Address with brackets, example: [10.10.10.10]
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

mikedibella
Normal user
Normal user
Posts: 177
Joined: 2016-12-08 02:21

Re: Send mail to local server from hotmail, gmail, etc.

Post by mikedibella » 2019-08-31 17:25

Wile.E.Coyote@10.10.10.10 is a perfectly acceptable mail address.
Maybe strictly speaking, but the RFC says the IP address has to be enclosed in braces:https://tools.ietf.org/html/rfc5322#section-3.4.1

Wile.E.Coyote@[10.10.10.10]

And:
It is therefore incumbent upon implementations to conform to the syntax of addresses for the context in which they are used.
So, IMO, you may find modern implementations do not continue to implement this syntax. I do not know if hMailServer does.

User avatar
SorenR
Senior user
Senior user
Posts: 3184
Joined: 2006-08-21 15:38
Location: Denmark

Re: Send mail to local server from hotmail, gmail, etc.

Post by SorenR » 2019-09-01 02:24

mikedibella wrote:
2019-08-31 17:25
Wile.E.Coyote@10.10.10.10 is a perfectly acceptable mail address.
Maybe strictly speaking, but the RFC says the IP address has to be enclosed in braces:https://tools.ietf.org/html/rfc5322#section-3.4.1

Wile.E.Coyote@[10.10.10.10]

And:
It is therefore incumbent upon implementations to conform to the syntax of addresses for the context in which they are used.
So, IMO, you may find modern implementations do not continue to implement this syntax. I do not know if hMailServer does.
I found GMail do remove the brackets.
With regards to the FWS and CFWS, I have never seen that used in addressing before in practical use ...

CFWS = Comments, Folding, Whitespaces.

Anyways, it's a nice thing to have when hackers kill the DNS servers. :mrgreen:
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

Post Reply