Asked By
Santos
30 points
N/A
Posted on - 05/30/2011
We are having a problem with sending out emails. We have an application server that runs a web application. The web application requires to send out emails.
For this purpose we installed an email server (PostFix) on the same machine. When the web application sends out emails to OTHER domains using local host, as the email relay server, it works. However, when we try to send emails that correspond to the same domain name as the application, we get the following error:
Answered By
Garrod
0 points
N/A
#111289
Emails do not go out from the website.
Isolate the problem, by checking if your website, is actually using the locally installed email relay. You can do this, by manually attempting to connect to the SMTP server and attempting to send an email via telnet. You can do this by using the telnet commands and logging on to the server. The SMTP commands are simple to use.
TELNET 127.0.0.1 25
USER <give your user login>
PASS <your password>
MAIL FROM: santos@*****domain.com
RECEIPT TO: another@******domain.com
DATA
At the end you will see an error message or a "Queued" message. In the event you get the same error message, then you need to tweak the settings in the email server application.
Answered By
Magnus
0 points
N/A
#111290
Emails do not go out from the website.
The mail server believes that, the domain name is locally hosted. It believes, it is the authorized mail server for the domain and is looking internally for the email box. I believe you already have a public mail server out on the internet and you are using the locally installed mail server, to relay emails only.
What needs to be understood, is that, when you configure a local mail server to relay  email, you need to tell it that all domains are non-local, or external. This will effectively disable local user lookup and treat all domain names as internet based and not local based.
What you can do is, set the Postfix server to some other domain other than secretdomain.com. This will make the server think that all domains are non-local.
Answered By
Santos
30 points
N/A
#111291
Emails do not go out from the website.
We do indeed have a mail server dedicated to receive emails. It is just that, we are not allowed to connect to an external mail server outside our hosting providers network. Therefore, we have to install a mail relay agent on the same server.
I will check this out and let you know if it works. Would this have any problems with spam filters?
Answered By
Garrod
0 points
N/A
#111292
Emails do not go out from the website.
Spam filters generally do a reverse lookup, to check if the email that is being sent, is coming from an IP address that is tagged to the domain name. This is usually done by checking the spoofing record text files. It is a plain text file that is uploaded to the DNS server, that contains policy information on sending out email. This is commonly known as a SPF record. SPF stands for Sender Policy Framework.
SPF records play a vital role in email authentication. You upload the record to DNS, stating what are the valid servers that will be relaying email for your domain. You can also list the specific public IP addresses of your email server boxes, so that all email originating as if from your domain are marked as valid, as long as the IP addresses are added to the SPF Record.
The multiple IP address facility is present, because a single IP address may be shared between several websites. Spam servers do a reverse lookup on the IP address to check, if the IP matches the domain. If not, it will lookup the SPF record from the DNS domain name to see if the IP address is enlisted. If the IP address is enlisted, the email is ok. Otherwise it is marked as spam.
Answered By
Magnus
0 points
N/A
#111293
Emails do not go out from the website.
Changing the local mail server and assigning it to a different domain name will not be a problem. As long as the IP address is not blacklisted, you will be ok. In the event, your web application is sending too many emails to any single domain, Internet Service Providers may black list your IP address. Therefore, you need to monitor the application and take precautions if you are sending bulk email.
What I can suggest is that you can schedule your emails to be sent, batch-wise, on a periodic basis. This will keep your IP address on the safe list, as well as allowing you to send emails out.
The mail server by default attaches the emails to its machine name. If your machine name is set to localhost.secretdomain.com, then you will have a problem.
You can edit the /etc/host file and change the machine name to something else. This usually fixes the problem.
Answered By
Magnus
0 points
N/A
#111294
Emails do not go out from the website.
The SPF record is actually a DNS server entry. It needs to be created on the DNS server. You have to do it via the domain administration panel. This panel is provided by the website, from which you bought the domain from. You will need to login to the control panel and then look for an option called "Edit DNS Records".
New domain hosting control panels allows you to add a DNS record of type SPF. If this is not available, select the option called "TXT". Then you can add the following string as the data:
v=spf1 mx ip4:yourmailserveripaddress -all
The above states to accept your application mail server IP address, as a sender of emails for your domain name.
Answered By
Santos
30 points
N/A
#111295
Emails do not go out from the website.
Thank you, Magnus for the clarification on the SPF record. I created a text file and uploaded to my web application, before I read your post. I registered my domain name at godaddy. I followed your instructions and added the SPF record.
On the other hand, I got my Linux IT guru, to take a look at this post and to check what he could do. As per the advise given he went and changed the machine name. And then it worked!
Thank you again!
Answered By
Garrod
0 points
N/A
#111296
Emails do not go out from the website.
Magnus, I did not know that the machine name would be a problem!
Thank you for the pointer. That was more simple than changing the mail server settings! It requires a reboot but that is ok!
I will update my knowledge base with this new information!