Mail of PHP, DNS request timed out, and FQDN - dns

I want to make mail() of PHP work in my Windows Server 2012 R2. To this end, I first installed SMTP by following this page.
One thing that confuses me is the Full-qualified domain name. WIN-RFELH8GM0KN is what it proposes by default. My server hosts several websites, does anyone know which website I should specify here?
I did not change this, as a consequence, mail www.google.com in nslookup returns DNS request timed out. So is it an error?
Of cause, my test.php does not send the mail:
<?php
mail('mymail#gmail.com', 'title', 'content');
?>
Could anyone help?
Update 1 Following the answer of #LittleAI , I started SMTP, but DNS request timed out is still there:
Update 2 Here is php.ini:
telnet localhost 25 returns the follows:
Update 3 Here was a test, which worked well: I did receive the test mail in the inbox of softtitmur#gmail.com. However, if I redo the test in Update 1, there is still DNS requested time out.. And test.php still cannot send the mail...
Update 4 I just realised that in the page I followed, it is mail.vsysad.com under nslookup (I thought it was mail vsysad.com, that is why i tried mail www.google.com which did not make sense). So it works also in my server, and there is no DNS request timed out.
Then, I double checked php.ini, I realised that sendmail_from was not uncommented. So I uncommented it and set sendmail_from = softtimur#gmail.com, as a result, mail() of php works now, so the problem is solved, though I still don't understand FQDN and its default value (ie, WIN-RFELH8GM0KN)...

The first thing I noticed is that your SMTP Virtual service in IIS is not in a starting state so this would cause an issue. Make sure this service is in a starting state before testing.
The FQDN name is mainly used for the SMTP banner which the sender will be presented when connecting over port 25 to your server.
It maybe worth installing the DNS role onto your server and create a forward lookup zone referencing a fake domain e.g test.com and create an a record within this zone called SMTP using your servers IP. Make sure to then set your server to use 127.0.0.1 as the DNS provider so it can check record before delegating the reponse to root hints/external dns forwarder.
You need to do an SMTP request using Telnet to confirm SMTP is listening on port 25. You can do this by using the localhost ip address (127.0.0.1) as shown below:
telnet 127.0.0.1 25
helo test.com
MAIL FROM: ****YOUR EMAIL ACCOUNT****
RCPT TO: ****SENDERS ADDRESS****
DATA
You would probably not receive the email from your relay to GMAIL due to SPF Record which is in place that only allows certain IP/hostnames to send as google.com, but for testing you should see your server receive the mail after data has been inputted.
Here is the guide for using telnet on your server. Just make sure you have telnet feature installed as this is not installed by default.
http://www.yuki-onna.co.uk/email/smtp.html
Additional:
telnet localhost 25
After the SMTP banner type the following command in but make sure not to make any mistakes or else you'll need to probably start your sesssion all over again.
helo test.com
You should then see a 250 response to say the server is listening
The type the following:
MAIL FROM: test#test.com
It should respond with OK. If so, then type:
RCPT TO: ***YOU EMAIL ADDRESS OF CHOICE****
Again, it should respond with OK. If so, type the following:
DATA
Press enter after the DATA command. Your now into the body of the email. For testing purposes we will miss the subject bar and just add some data to the body.
This is a test email.
Then to complete the email you need to leave a blank line by pressing return, then a full stop, then return again like so.
***BLANK LINE****
.
***Hit Return****
Screenshot all the commands but you can blank out the email so I can see the output.

Related

Getting "Server temporarily unavailable. AUP#MXRT" while sending bulk emails (Deferred Emails)

I have a VPS server with CPanel on my domain (say mydomain.com). I have a SuiteCRM installed on a subdomain (say sub.mydomain.com) and I am sending mass emails from it in a batch of 90 every hour.
While sending the emails from the CRM (Authenticated SMTP mode) the emails are getting deferred with the error:
SMTP error from remote mail server after MAIL FROM:< myemail#mydomain.com> SIZE=562346: 451 <myemail#mydomain.com> server temporarily unavailable. AUP#MXRT
The SPF, DKIM and DMARC everything is fine.
I am suspecting it could be a max rate warning/failure (MaXRaTe hence MXRT) from the remote/recepient mail server. It is failing/deferring emails for Gmail, Yahoo and other email providers not for any company-specific emails like someone#somecompany.com
There seems a limit on emails for Gmail and other vendors. I had gone through these where Gmail specifically pointing out the limits and do's and don'ts:
https://support.google.com/mail/answer/22839?hl=en#zippy=%2Cyou-have-reached-a-limit-for-sending-mail
https://support.google.com/mail/answer/81126
In my case, I find myself well under the limit. So, why I am getting this error?
Second thought: It could be due to that I am sending 90 emails in one go. If I send emails one-by-one after a delay (say 3-5 seconds) then there won't be any problem. Enlighten me on this too.
I later realized that, even any one-to-one email I am sending via Thunderbird from my server (SMTP), even to a single recepients, is failing. I have checked check.spamhaus.org and intodns.com everything is alright there.
My Environment (Though this hardly matter in context of my problem but just in case):
BigRock's VPS Server with CPanel (Version)
Apache Version: 2.4.53
MySQL Version: 8.0.29
WHM Version: 102.0.18
CentOS Version: 7.9.2009 (Standard KVM)
Note: I haven't mentioned my actual domain name just for the privacy and security since I feel putting everything here will pose risks.

Exim: email#example.com is undeliverable: Unrouteable address

I have a main server where are placed the DNS records for a domain (eg: example.com), but this domain has another server only for webmail. The DNS setup is working fine: I can access example.com through the browser and the webmail can send/receive emails (from webmail.example.com - A/MX DNS records are ok).
The problem is that on example.com there's a page where I send emails to contact#example.com and this is not being delivered - it works with anything else (Gmail, Hotmail etc).
I've tried some different things I found on Google/StackOverflow to fix it but without success.
exim -bt noreply#example.com (returns: router = localuser, transport = local_delivery)
exim -bt contact#example.com (returns: contact#example.com is undeliverable: Unrouteable address)
Where noreply# was created on the main server to send the emails from that page and contact# was created at the second server (webmail server). It looks like Exim4 is always looking for internal email addresses for this domain, even though the MX record is setup for another server.
How I could fix it? Exim4 should look for the MX record instead of trying to deliver it locally.
Thank you.
you have set example.com as a local domain. don't do that except on the MX server for example.com.

How to setup test SMTP server for devices on local network

I've been trying to figure this out for a couple days now. I've got a little linux box that should send email alerts and I need to test this functionality. It's a very, very basic linux box (painfully so).
Is it possible to setup a fake SMTP server on my desktop (IP:192.168.0.20) that it (192.168.0.2) can send emails to? I need to confirm that the messages are correct in content, but that's all. I'm perfectly fine having this spit out to the terminal. There's no DNS on the local network, or DHCP, I'm just using static IP addresses so it needs to work within that limitation.
I've been able to confirm with wireshark that the embedded computer is trying to do something over SMTP, but I don't see any message content at all, looks like it's just trying to talk to the server. I've also tried sending a message using "mail" but I keep getting an "SMTPclient: agent: unknown host" error, which I assume means it can't find the SMTP server I'm telling it to find.
I'm using Ubuntu 14.04 on my desktop.
Thanks!
So, as a basic test it works to just have an SMTP server running on your local machine. Installing Postfix should be all that's required. I set up the relay to our local mailserver but it wouldn't relay through. From the error messages I was getting I gather this is a DNS issue, it can't resolve where to direct the message. Watching wireshark you should be able to see the traffic and the attempt to send the message, which is something I guess. I will update when I have a better answer.

Should I see email on port 25 with netcat?

Assuming I have a domain forwarded properly to a box (i.e., I can see a webpage on the box from the outside world) If I use netcat to listen on some ports from a ssh session:
nc -l 587
nc -l 25
and send mail to the server user#mydomain.com
I should see the beginning of the handshake in the send attempts? I know my ISP does not block port 25 because I can see a browser header with netcat if I go to http://mydomain.com:25
Tons of things could be going wrong:
1) SMTP requires the server talk first, so the email sender is probably waiting for your server to say something.
2) If you're not running a valid mail server, email senders may mark your host as unresponsive and backoff for several hours before retrying.
3) If you just changed your DNS, it may take hours/days for that to propagate. (Not everyone respects TTL, especially low ones.)
4) Some servers are configured to drop mail if the source or destination SPF isn't set up properly. (To encourage everyone to use SPF.) Try adding a SPF record. (And make sure your MX record is correct.)

Mails Going to spam even after adding SPF and DKIM

I've configured Webmail in Cpanel, and enabled SPF and DKIM, but still the mails are going to spam in gmail. Yahoo is receiving the mails in inbox. My Domain and IP are not blacklisted. Please let me know if anyone knows the solution.
Nerdy Bird here! Have you by any chance tailed any of the exim error logs?
Try this:
Assuming you have root access to the server, ssh into the server as Root, the run the line below (NOTE: username is the beginning of the email address 'john#somedomain.com'. So in the below example, you would replace username with john). This makes searching the logs much easier).
tail -f /var/log/exim_mainlog | grep -i username
Upon running the above line, send an email from your webmail account to another account (Gmail in this case). Once you've done that, output should display in the terminal. The output is the best insight into your mail issue.
Also, if you have command line access, try using telnet. If you can connect by running the following line, you can rule out issues with outgoing ports on the server.
FOR PORT 25:
telnet alt2.gmail-smtp.in.l.google.com 25
If you get a connected message, port 25 is open and able to send mail.
FOR PORT 26:
telnet alt2.gmail-smtp.in.l.google.com 26
If you get a connected message, port 26 is open and able to send mail.
Other Possible Issues
You could possible not have a RDNS (reverse dns record) setup for your server's/domain's IP address. If not, please consult with your Hosting provider to see that gets added and allow time for propagation.
Port mail is being sent on is by default port 25. Sometimes ISPs' block mail coming from port 25. Try changing this port to port 26. This is typically done via command line or in WHM (Webhost Manager). If you do not have access to WHM or CMD, contact your hosting provider.
Although you stated your IP is not blacklisted, please check again. We use MXtoolbox.com
Hope this helps. Need more let us know.
Nerdy Bird
In my case, I tried a whole lot of things but at the end, I verified my site in https://www.google.com/webmasters and added it as a property after which email from my webmail started going to Gmail inbox again instead of spam.

Resources