inicenter logo

SMTP Server for PHP in three lines using Office Mail (OM3):

  • Add Username
  • Add Password
  • Add Email Address

I never said it was difficult.

Apart from SMTP and POP you get Webmail. This all adds up to a nice USB test environment.

  MX and DNS
uniform server logo

MX records and DNS

I have included this section for completeness. When you run your own mail server and it uses SMTP for e-mail transfer you will need to configure the MX Records for your domain. In reality it means adding a single line to your zone file however to prevent being blacklisted you will want to add a few extra lines.

DNS and zone files

Zone files are nothing more than a text file containing DNS records; this file has a specific format and runs on a DNS server. If you are running your own DNS you probably know how to write zone files. I am lazy and my domain registrar hosts my zone file and provides both primary and secondary name servers. They also mask parts of the zone file that I do not need to change, all I have to do is add records pertaining to my domain. The example below shows the main parts in addition I have provided a list of common mistakes more in-depth information can be found on the Internet.

Zone file example

$TTL	86400 ; 24 hours
@  IN	SOA	 ns1.bogus.com.	support.bogus.com. (
				20010923; Serial
				10800	; Refresh after 3hrs
				3600	; Retry after 1 hr
				604800	; Expire in 1 week
				86400 ) ; Minimum ttl 1 day 
	IN	NS   ns1.bogus.com. ;named server
	IN	NS   ns2.bogus.com. ;named server
    
My registrar automatically generates this section of the zone file however I do have the option to override it. The next two sections have been manually added they define my server set-up.
bogus.com.   	IN	A	12.34.56.789
www.bogus.com. 	IN	CNAME   bogus.com. ;web server
ftp.bogus.com. 	IN	CNAME	bogus.com. ;ftp server
mail.bogus.com.	IN	A	12.34.56.789   ;mail server
bogus.com. IN MX 10 mail.bogus.com. ;mail server
This section points my domain name bogus.com to my fixed IP address 12.34.56.789 I am running three servers from that IP address.

To access the web server a user would type www.bogus.com into a browser the CNAME points this to bogus.com which is an A record that points to my IP address. The ftp server has a similar set-up.
bogus.com. 28800 IN TXT "v=spf1 a mx a:12.34.56.789 mx:bogus.com"
redir-mail-tele1.fred.net. IN TXT "v=spf1 a -all"
redir-mail-tele2.fred.net. IN TXT "v=spf1 a -all"
To prevent blacklisting by some mail servers a section similar to this is required see details below.

MX record

I have two records in the zone file that define my mail server. A user would send an email to the following address nameX@bogus.com; bogus.com has an MX record this points to mail.bogus.com the address of my mail server. I have defined an A record for mail.bougus.com that points to my IP address. The mail server will direct any mail to the appropriate user nameX. In this example the A record is not required it is shown to emphasize the fact that MX records must always point to an A record and not IP addresses or CNAME’s. The two lines

mail.bogus.com. IN A 12.34.56.789 ;mail server definition
bogus.com. IN MX 10 mail.bogus.com. ;mail server

Can be replaced with this single line since bogus.com is an A record.

bogus.com. IN MX 10 bogus.com. ;mail server

Note: The period at the end of each name, this terminates that name definition and prevents the software adding anything extra to the name.


MX Record notes

  • MX records MUST NOT point to a CNAME record.
  • MX records MUST NOT point to an IP address.
  • Do NOT use wildcards a "*" in a domain name.

SPF Record

Sender Policy Framework (SPF) provides domain owners a method of providing proof that the mail originated from their mail servers and not from another source. Hence reducing the amount of Spam I have show a typical record in green.

Do you need an SPF record, well the choice is yours but more and more larger ISPs are using it to validate the origin of emails. If the origin does not validate the mail is bounced back to the sender. At the time of writing (21-5-07) I believe without one you run the potential risk that you domain will be blacklisted I am not 100% sure of this but hey why risk it. An SPF record is relatively easy to generate on the open Sender Policy Framework web site.

You need to do a little reading however they do provide a very useful online wizard to make the task easier well worth a visit at http://old.openspf.org/wizard.html


Test your DNS

After publishing your zone record testing it can be time consuming especially using a command prompt.

Take the easy option and use some online tools, my personal favorite is http://www.dnsstuff.com/ they provide a paid service however they still offer their free service that still remains excellent, scroll down their main page to find the tools.

Type your domain name in the DNS report and press the button you get a full report and I do mean full. Anything highlighted in red and you have problems, yellow are warning however you should read these.

 

 

<< SMTP and General :: Errors >>

image top

• UniCenter Site Content Copyright © 2006-2007  Mike Gleaves  All Rights Reserved 21-5-2007 •

Contact & Copyright

Copyright 2002-2006 The Uniform Server Development Team All rights reserved.

For installation-related support issues, contact support@Uniformserver.com

For general information and support, refer to our site at http://www.Uniformserver.com