Sending mail doesn't work

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

Sending mail doesn't work

Post by qneo » 2019-09-05 14:04

Hello.

I'm trying to send mail from local mail server to my hotmail, but I don't get the mail. However, sending mail from hotmail to local mail server works fine.

The log file says:

"SMTPD" 324 44187 "2019-09-05 13:52:00.791" "127.0.0.1" "SENT: 220 ADMIN-DATOR ESMTP"
"SMTPD" 324 44187 "2019-09-05 13:52:00.792" "127.0.0.1" "RECEIVED: HELO Admin-Dator"
"SMTPD" 324 44187 "2019-09-05 13:52:00.793" "127.0.0.1" "SENT: 250 Hello."
"SMTPD" 324 44187 "2019-09-05 13:52:00.793" "127.0.0.1" "RECEIVED: MAIL FROM:<user1@almighty.se>"
"SMTPD" 324 44187 "2019-09-05 13:52:00.794" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 324 44187 "2019-09-05 13:52:00.795" "127.0.0.1" "RECEIVED: RCPT TO:<mymail@hotmail.se>"
"SMTPD" 324 44187 "2019-09-05 13:52:00.799" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 420 44187 "2019-09-05 13:52:00.800" "127.0.0.1" "RECEIVED: DATA"
"SMTPD" 420 44187 "2019-09-05 13:52:00.800" "127.0.0.1" "SENT: 354 OK, send."
"APPLICATION" 1988 "2019-09-05 13:52:00.809" "SMTPDeliverer - Message 22337: Delivering message from user1@almighty.se to mymail@hotmail.se. File: C:\hMailServer\Data\{A08DA31C-CEE8-47B4-99AE-6F7D67871510}.eml"
"SMTPD" 1924 44187 "2019-09-05 13:52:00.810" "127.0.0.1" "SENT: 250 Queued (0.000 seconds)"
"SMTPD" 464 44187 "2019-09-05 13:52:00.811" "127.0.0.1" "RECEIVED: QUIT"
"SMTPD" 464 44187 "2019-09-05 13:52:00.811" "127.0.0.1" "SENT: 221 goodbye"

"APPLICATION" 1976 "2019-09-05 13:52:30.802" "SMTPDeliverer - Message 22336: Message could not be delivered. Scheduling it for later delivery in 60 minutes."
"APPLICATION" 1976 "2019-09-05 13:52:30.804" "SMTPDeliverer - Message 22336: Message delivery thread completed."
"APPLICATION" 1988 "2019-09-05 13:52:42.888" "SMTPDeliverer - Message 22337: Message could not be delivered. Scheduling it for later delivery in 60 minutes."
"APPLICATION" 1988 "2019-09-05 13:52:42.890" "SMTPDeliverer - Message 22337: Message delivery thread completed."

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

Re: Sending mail doesn't work

Post by jimimaseye » 2019-09-05 14:38

Were you using yahoo as a relay? They have been down for the last 6 hours.
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: Sending mail doesn't work

Post by qneo » 2019-09-05 14:44

I'm not using relay.

tunis
Normal user
Normal user
Posts: 222
Joined: 2015-01-05 20:22
Location: Sweden

Re: Sending mail doesn't work

Post by tunis » 2019-09-05 17:03

What are your "SMTPC" says in the log?
They are your server's outgoing logs.
HMS 5.6.8 B2437.17 on Windows Server 2019 Core VM.
HMS 5.6.8 B2451.21 on Windows Server 2016 Core VM.
HMS 5.6.7 B2425.16 on Windows Server 2012 R2 Core VM.

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-05 17:48

Cant find SMTPC in the log file, only SMTPD.

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-05 19:23

I use my isp's smtp as the remote host name now, it works, but the mail ends up in spam. What can I do?

User avatar
jim.bus
Senior user
Senior user
Posts: 293
Joined: 2011-05-28 11:49
Location: US

Re: Sending mail doesn't work

Post by jim.bus » 2019-09-06 08:06

qneo wrote:
2019-09-05 19:23
I use my isp's smtp as the remote host name now, it works, but the mail ends up in spam. What can I do?
What do you use for the Local Host Name. This must be the Host Name of the server running hMailServer. See excerpt from the hMailServer Help Documentation below.

I am guessing you do not have any value in the Local Host Name entry or the Local Host Name entry is not using the Local Host Name for your hMailServer installation. I further believe this to probably be the case since your logs show your IP Address to be 127.0.0.1 which is not an External Public IP Address. IP Address 127.0.0.1 is sort of an IP Address that represents the actual computer (in this case) hMailServer is running on. It is not the External Public IP Address which is what you need to supply in the Local Host Name entry. Receiving email Servers may check for the Local Host Name entry resolving to the IP Address of your hMailServer installation and if it doesn't they will generate a SPAM Score or something equivalent when the Local Host Name does not resolve to your hMailServer's Public IP Address (this can be the same host name used in your DNS MX Record for hMailServer).

Excerpt from hMailServer Help Documentation:

Host name

When an SMTP server connects to another server to send a message, the first thing that happens is that the sending server identifies itself using the host name. Since there is no way to safely auto-detect the host name of a computer, you have to specify this setting manually. The host name must resolve to the IP address of the computer which is running hMailServer. Some servers will validate this and classify your email as spam if it does not resolve properly.


It does not matter what host name you enter, as long as it resolves to the IP address where hMailServer is running. You may have 15 different host names which resolves to the IP address hMailServer is running on. If this is the case, you can enter any of these 15 different host names in the Host name field.

Example: If hMailServer is running on a machine whose host name is mail.domain.com, you should specify mail.domain.com as host name. If your machine has several public host names, such as mail.domain.com and mail.domain2.com, you may specify any of them as host name.

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-06 09:18

In hmailserver, local host name is already: mail.almighty.se

However in my php.ini file, smtp = localhost. When I change localhost to mail.almighty.se hmailserver log shows the ip 192.168.1.1 instead of 127.0.0.1.

Still no good

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

Re: Sending mail doesn't work

Post by jimimaseye » 2019-09-06 09:24

qneo wrote:
2019-09-05 19:23
I use my isp's smtp as the remote host name now, it works, but the mail ends up in spam. What can I do?
This is your problem. We have already identified you are running from a residential ip address (hence the need for using a relay). But your domain dns records or spf will not permit your relay as authorised sender.

Therefore spam.

Change your spf record to permit relay up address as a sender.

[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

User avatar
jim.bus
Senior user
Senior user
Posts: 293
Joined: 2011-05-28 11:49
Location: US

Re: Sending mail doesn't work

Post by jim.bus » 2019-09-06 10:10

qneo wrote:
2019-09-06 09:18
In hmailserver, local host name is already: mail.almighty.se

However in my php.ini file, smtp = localhost. When I change localhost to mail.almighty.se hmailserver log shows the ip 192.168.1.1 instead of 127.0.0.1.

Still no good
The IP Address of 192.168.1.1 is an indication in the hMailServer Logs that mail.almighty.se is the Local Host Name because in hMailServer Logs IP Address 192.168.1.1 is the LAN Side IP Address of your Router's WAN IP Address (External IP Address of your Local Network). When you reference mail.almighty.se from within your Local Network instead of the External IP Address you will see the LAN side IP Address in your hMailServer Logs which in your case is 192.168.1.1 so this should mean you are using a correct Local Host Name now.

I myself don't use a Relay so I do not have much experience using them but my next guess as to what I would have tried is what jimimaseye has stated to do which is to change your DNS SPF record to designate your SMTP Relayer Host name as a permitted server for your Domain Name and don't forget to include a PTR entry in the SPF Record as that can also cause a receiving server to reject the email you send to it.

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-06 10:45

Like this ?

name:mail.almighty.se, type:TXT, data: "v=spf1 include:mailout.telia.com -all", prio: 0, ttl: 120

tunis
Normal user
Normal user
Posts: 222
Joined: 2015-01-05 20:22
Location: Sweden

Re: Sending mail doesn't work

Post by tunis » 2019-09-06 10:59

qneo wrote:
2019-09-06 10:45
Like this ?

name:mail.almighty.se, type:TXT, data: "v=spf1 include:mailout.telia.com -all", prio: 0, ttl: 120
mail.telia.com has no spf, so there is nothing to include.

Use a:mailout.telia.com instead of include:mailout.telia.com.
HMS 5.6.8 B2437.17 on Windows Server 2019 Core VM.
HMS 5.6.8 B2451.21 on Windows Server 2016 Core VM.
HMS 5.6.7 B2425.16 on Windows Server 2012 R2 Core VM.

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-06 11:03

name: mail.almighty.se
data: "v=spf1 a:mailout.telia.com -all"

still goes to junk

User avatar
jim.bus
Senior user
Senior user
Posts: 293
Joined: 2011-05-28 11:49
Location: US

Re: Sending mail doesn't work

Post by jim.bus » 2019-09-06 11:21

qneo wrote:
2019-09-06 10:45
Like this ?

name:mail.almighty.se, type:TXT, data: "v=spf1 include:mailout.telia.com -all", prio: 0, ttl: 120
I am not familiar with the format of your Domain Registrar's DNS Zone File but with what I am familiar with mail.almighty.se would be in a part of the same string of characters after v=spf1. Again with what I am familiar, you want to list all host names of servers which are permitted senders of the domain almighty.se as used in the email account you showed in your logs. The '-all' parameter at the end of the string indicates that all other host names are not permitted senders of domain almighty.se.

As I understand how this mechanism in general works you will go to your Zone File for the Domain almighty.se. In it you will have a TXT type record such as possibly what you have showed. Guessing from what I see you have built, it would look like mailout.telia.com is a permitted host name to use to send email for the Domain almighty.se (assuming this TXT Record is in the Zone File for Domain almighty.se. You want to have mail.almighty.se appear as one of the permitted host names to send email from the almighty.se Domain. What I see I am guessing does not accomplish that. You also from what you have displayed do not show where there is a PTR entry for the host name mail.almighty.se nor the host name mailout.telia.com which means that potentially both host names might be rejected by a receiving email server. I have made the assumption that the Domain is almighty.se as that is what I saw as the senders Domain Name in your hMailServer Logs.

If you need help in setting up the SPF and PTR TXT Record your Domain Registrar should be able to help you with that. I am somewhat limited in telling you how to set up the SPF as my only experience with these records is through my own Domain Regisstrar Zone File format though I would suspect that the actual format of the string of characters after the v=spf1 entry would be the same for all Zone Files.

User avatar
jim.bus
Senior user
Senior user
Posts: 293
Joined: 2011-05-28 11:49
Location: US

Re: Sending mail doesn't work

Post by jim.bus » 2019-09-06 12:06

qneo wrote:
2019-09-06 11:03
name: mail.almighty.se
data: "v=spf1 a:mailout.telia.com -all"

still goes to junk
Your hMailServer Log entry shows you are sending from an email account in the Domain almighty.se (user1@almighty.se). If this is the case then why are you listing the spf record for mailout.telia.com. Do mail.almighty.se and mailout.telia.com both resolve to the same External IP Address or are they different IP Addresses. If they are different I would suspect this is the reason unless the format of your TXT record is showing that nam: mail.almighty.se is somehow also a permitted sending host name. If the format of your TXT Record does accomplish that then the problem could be that you do not at least show us what the PTR Entry is. Some Email Servers will reject the email if there also is no PTR Entry (Reverse DNS). So since I do not see evidence of a PTR Entry, I would check to see if this is the cause.

From what little I know about building an SPF Record your format looks wrong. From your hMailServer Logs again I understand the Domain for your DNS is almighty.se and the host name for your External IP Address of the Local Network your hMailServer is running in is mail.almighty.se. I have checked and mail.almighty.se IP Address is not the same as mailout.telia.com so automatically you are going to fail the SPF SPAM test because the SPF TXT Record you are using only designates mailout.telia.com as the permitted sender. What you need to do is to list mail.almighty.se as the permitted sender or perhaps both host names if they are valid for this domain which somehow doesn't sound likely but it depends on what you are doing with the Domain this TXT SPF record is in.

Using the format for a TXT SPF Record I am familiar with I would believe the following should work for the Data String in your case and it is how I set up my SPF/PTR TXT Record and it works:

v=spf1 a mx ptr mx:mailout.telia.com ptr:mailout.telia.com mx:mail.almighty.se ptr:mail.almighty.se -all

In my Zone File Editor I do not need the quote marks, it looks like you probably need them for your Zone File Editor.

Again I do not know how mailout.telia.com relates to mail.almighty.se since they both resolve to different IP Addresses than the other and they are two different domains. If they have no relation to each other then you may need to get rid of the mailout.telia.com host name because it may serve no purpose.

Edited: I just realized mailout.telia.com may be your Relay Server hostname (your ISP's host name in other words) and in that case then definitely you would want to include the mailout.telia.com in your SPF TXT Record as I show it in my example above. My thoughts are you probably will need both host names because at least according to hMailServer Help Documentation a receiving sender looks at the Local Host name as well as the SMTP Relayer Remote Host Name. So maybe only mailout.telia.com may be needed but both host names might also be needed to satisfy all the requirements and it shouldn't hurt to have both listed.

tunis
Normal user
Normal user
Posts: 222
Joined: 2015-01-05 20:22
Location: Sweden

Re: Sending mail doesn't work

Post by tunis » 2019-09-06 14:45

qneo wrote:
2019-09-06 11:03
name: mail.almighty.se
data: "v=spf1 a:mailout.telia.com -all"

still goes to junk
spf name must be the same as after @ in email address (almighty.se) not mail.almighty.se.
HMS 5.6.8 B2437.17 on Windows Server 2019 Core VM.
HMS 5.6.8 B2451.21 on Windows Server 2016 Core VM.
HMS 5.6.7 B2425.16 on Windows Server 2012 R2 Core VM.

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-06 16:21

Yes. mailout.telia.com is remote host name/ISP because port 25 is blocked.

I changed name to almighty.se, and data: v=spf1 a mx ptr mx:mailout.telia.com ptr:mailout.telia.com mx:mail.almighty.se ptr:mail.almighty.se -all


Still junk :|

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

Re: Sending mail doesn't work

Post by mikedibella » 2019-09-06 16:37

The SPF record is for the mail domain (almighty.se), not the mail exchanger (mail.almighty.se).

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

Re: Sending mail doesn't work

Post by qneo » 2019-09-06 17:04

mikedibella, what do you suggest I change?

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

Re: Sending mail doesn't work

Post by mikedibella » 2019-09-06 18:19

You have the SPF record associated with the right DNS domain now (almight.se), but the record has errors:

https://www.dmarcanalyzer.com/spf/check ... lmighty.se

User avatar
jim.bus
Senior user
Senior user
Posts: 293
Joined: 2011-05-28 11:49
Location: US

Re: Sending mail doesn't work

Post by jim.bus » 2019-09-06 22:27

DNS Zone Files I am familiar with are set such that there is a Zone File for each DNS Domain.

If the DNS TXT Record is defined in the DNS Zone File for the DNS Domain almighty.se then you should not need to supply the 'name: almighty.se' parameter of the TXT Record. DNS should assume the TXT Record is for the Domain almighty.se. My understanding of DNS Zone Files is the Name is appended to your DNS Domain which in this case I am assuming you are defining this TXT Record in the DNS Domain Zone File for Domain almighty. This would mean the Name that actually would have been generated is 'almighty.se.almighty.se' which obviously would be an error. You have not yet stated what Domain you are setting up your TXT Record in so I am forced to assume your TXT Record is being set up in the Zone File for DNS Domain almighty.se.

As I previously stated I am not familiar with how SMTP Relayers actually work as I haven't done one before except for one trial and it didn't work satisfactorily the way I wanted it to but it did work. However, the TXT SPF Record I gave you without the 'Name: almighty.se' 'v=spf1 a mx ptr mx:mailout.telia.com ptr:mailout.telia.com mx:mail.almighty.se ptr:mail.almighty.se -all' tells the system that Email Server Host Names mailout.telia.com and mail.almighty.se are permitted Email Servers for the DNS Domain almighty.se assuming the TXT SPV Record is defined in the Zone File for the DNS Domain almighty.se.

If your TXT SPF Record still has errors then I would suspect that the format of the whole TXT SPF Record is what is wrong but I am fairly sure the Data Portion of the TXT SPF Record I gave you is correct because I have been using this DATA String type of format for years without any problems and therefore the DATA String I gave you should specify those two Host Names as permitted senders for the Domain almighty.se. This Data String also sets up supposedly what is necessary for the PTR portion of the TXT SPF Record I have been indicating is necessary.

Post Reply