LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   use remote smtp server? (https://www.linuxquestions.org/questions/linux-newbie-8/use-remote-smtp-server-4175422208/)

qwertyjjj 08-15-2012 10:37 AM

use remote smtp server?
 
I have a server that send out mail using PHP's mail, Linux sendmail, maybe postfix, and nail.
How can I change all of these processes so that they use a registered smtp server with correct MX records to ensure that the mail is not delivered to junk especially if it HTML email?

Kenarkies 08-15-2012 04:02 PM

I sort of understand why you want to make a change, but your post is a bit vague about how email is sent. Are you using several clients connecting to a local SMTP server on your machine/network? Or are you using a server provided off-site (ISP etc)? If you are using a local server and your IP address is not static, your email is unlikely to be delivered at all. Please elaborate.

cheers, Ken

choronozon 08-15-2012 04:45 PM

any SMTP relay can be directed to use an upstream ISP relay instead of going direct - see the documentation for whatever SMTP installation you have.

padeen 08-15-2012 08:39 PM

Also, no matter how you set up yours and your upstream servers, you have no control over whether something in the chain flags the message as junk. That happens at the recipient's mail application, and possibly their immediate upstream mail provider (my ISP runs a spam detector on any mail they deliver to me).

The answer is, of course, to write mail that doesn't appear to be spam.

linjoy42 08-15-2012 09:56 PM

If you are looking for a way to do this without reconfiguring the serverwide smtp settings, you can use the php Pear mail package instead of the built in mail command

choronozon 08-16-2012 03:18 AM

Quote:

Originally Posted by padeen (Post 4755126)
Also, no matter how you set up yours and your upstream servers, you have no control over whether something in the chain flags the message as junk. That happens at the recipient's mail application, and possibly their immediate upstream mail provider (my ISP runs a spam detector on any mail they deliver to me).

The answer is, of course, to write mail that doesn't appear to be spam.


well yes and no. Filters like spamhaus will check the source IP address for blacklisting. Using a relay avoids that.

jgm27 08-16-2012 04:23 AM

I use Blat which was very easy for a Linux newbie like me to set up to use my own smtp server.
Regards,
John

qwertyjjj 08-16-2012 04:38 AM

Quote:

Originally Posted by Kenarkies (Post 4754969)
I sort of understand why you want to make a change, but your post is a bit vague about how email is sent. Are you using several clients connecting to a local SMTP server on your machine/network? Or are you using a server provided off-site (ISP etc)? If you are using a local server and your IP address is not static, your email is unlikely to be delivered at all. Please elaborate.

cheers, Ken

At present I send mail using the local Linux box, which is just an IP address, not registered with any domains and no MX records. The mail comes from name@mydomain.com
So, the mails get delivered (to most ISPs) but delivered as junk or not delivered at all (AOL, etc). I have access to a smtp server with the actual domain and proper MX records of mydomain.com but it is on a different remote server.

Quote:

Originally Posted by padeen (Post 4755126)
Also, no matter how you set up yours and your upstream servers, you have no control over whether something in the chain flags the message as junk. That happens at the recipient's mail application, and possibly their immediate upstream mail provider (my ISP runs a spam detector on any mail they deliver to me).

The answer is, of course, to write mail that doesn't appear to be spam.

It is picked up as spam because of the non MX records on the local server. Not all HTML email is picked up as spam is it?

Quote:

Originally Posted by linjoy42 (Post 4755176)
If you are looking for a way to do this without reconfiguring the serverwide smtp settings, you can use the php Pear mail package instead of the built in mail command

But that is only PHP, what about perl scripts, nail, postfix, sendmail, etc.?

Quote:

Originally Posted by choronozon (Post 4755359)
well yes and no. Filters like spamhaus will check the source IP address for blacklisting. Using a relay avoids that.

Exactly, see MX record issue above and the domain name.

Quote:

Originally Posted by jgm27 (Post 4755413)
I use Blat which was very easy for a Linux newbie like me to set up to use my own smtp server.
Regards,
John

Won't help as the smtp server will be on the local box then but it is still only an ip address. The registered mydomain.com is on a different remote server. So, any mail sent from the local box with name@mydomain.com as the from address will be picked up with incorrect MX records ebcause it is not sent from mydomain.com but sent from 86.IP.IP.IP

jgm27 08-16-2012 04:59 AM

Wouldn't it be simpler just to buy a domain for a few dollars a year and apply this to your server or use your domain provider to set up a sub domain.
Regards,
John

Kenarkies 08-16-2012 05:52 AM

It's unlikely to be the lack of DNS MX records causing non-delivery. Most likely you have a dynamic address from your ISP unless you have specifically bought a static address, and as such external SMTP servers will not relay or deliver anything sent from that address, even if you have a domain name. Make sure you have a static address (if you can get one now since IP4 has run out of addresses AFAIK). Then you can get a free domain name from someone like DynDNS, if you are happy with their kinky offerings.

On the other hand your ISP should almost certainly provide an SMTP server which will be happy with relaying your mail as you will have been authenticated with them when setting up the connection.

I'm pretty sure you can receive mail directly to your machine (rather than through the ISP's POP3 or IMAP4 servers) even with a dynamic IP address, as DNS servers like DynDNS will follow changes to your address. However you will need to setup a complex mailserver to handle it. A lot of work!

cheers, Ken

qwertyjjj 08-16-2012 07:51 AM

Quote:

Originally Posted by Kenarkies (Post 4755465)
It's unlikely to be the lack of DNS MX records causing non-delivery. Most likely you have a dynamic address from your ISP unless you have specifically bought a static address, and as such external SMTP servers will not relay or deliver anything sent from that address, even if you have a domain name. Make sure you have a static address (if you can get one now since IP4 has run out of addresses AFAIK). Then you can get a free domain name from someone like DynDNS, if you are happy with their kinky offerings.

On the other hand your ISP should almost certainly provide an SMTP server which will be happy with relaying your mail as you will have been authenticated with them when setting up the connection.

I'm pretty sure you can receive mail directly to your machine (rather than through the ISP's POP3 or IMAP4 servers) even with a dynamic IP address, as DNS servers like DynDNS will follow changes to your address. However you will need to setup a complex mailserver to handle it. A lot of work!

cheers, Ken


The mail is delivered, it just goes to junk as it comes from an unrecognised domain. Some ISPs block it completely eg AOL as they do an MX check.
Yes, the ISP has an smtp server that I want to use but I don't know how to change sendmail, PHP mail, postfix, and nail as per OP :)

Quote:

Originally Posted by jgm27 (Post 4755440)
Wouldn't it be simpler just to buy a domain for a few dollars a year and apply this to your server or use your domain provider to set up a sub domain.
Regards,
John

I already have a domain but the domain is linked to a webserver at the hosting company.
mydomain.com running at the webs server host
MX records at hosting company have stmp.hosting.com access
justanip.address.x.x @ separate dedicated server running other functions

So, there are 3 separate servers at different locations (web server, smtp server, local server)

I could buy another domain name to run on the local server but then they would receive mail from slightyldifferent-mydomain.com not mydomain.com
I could add a webserver and smtp on the local server too but I don't want to at the moment for performance and it would be a lot of effort to move files and DNS settings.

Linuxmonger 08-16-2012 08:17 AM

send via SMTP relay
 
First, find out what your primary server is running with telnet;
telnet localhost 25

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 mail.somedomain.com ESMTP Postfix
quit
221 2.0.0 Bye
Connection closed by foreign host.

In this case it's Postfix (see it in the output?)

Add a line in /etc/postfix/main.cf
relayhost = [my.relay.host.org]
And yes, the square brackets are supposed to be there.

Restart Postfix with /etc/init.d/postfix restart

And all should be good - adjust paths to files to suit your distribution, and if you need more assistance, please post the result of your telnet session

qwertyjjj 08-16-2012 08:33 AM

edit

Linuxmonger 08-16-2012 01:33 PM

More on my previous post
 
I'm not sure how php-mail works, but I had made an assumption that all of the mail was directed at the machine without the proper DNS entries. Nail for certain works nicely with localhost as the SMTP server, and if everything is local, it's simple to then have the local machine forward to an upstream mx. Don't forget to tell the upstream mx that you will be relaying to it, and add a forward or two so you can receive reply and bounce messages.

Kenarkies 08-17-2012 03:33 AM

Quote:

Originally Posted by qwertyjjj (Post 4755553)
The mail is delivered, it just goes to junk as it comes from an unrecognised domain. Some ISPs block it completely eg AOL as they do an MX check.
Yes, the ISP has an smtp server that I want to use but I don't know how to change sendmail, PHP mail, postfix, and nail as per OP :)

OK that makes sense, they will use all and any checks to filter out potential undesirable stuff.

So I guess it reduces to GIYF (Google is your friend). e.g. for sendmail there is http://cri.ch/linux/docs/sk0009.html as an example, and others as well. It's just a matter of ploughing through the arcane Linux config files with the help of those who suffered before us. Using your own ISP is easy as they know who you are and will relay without hassles. You won't need a domain name.

Quote:

I could buy another domain name to run on the local server but then they would receive mail from slightyldifferent-mydomain.com not mydomain.com
If you are going to run an SMTP server on your local machine (like sendmail or postfix), get any name at all from a company like DynDNS (no charge for one or two) and the receiving machines should be satisfied. It won't affect the actual domain name used for receiving your mail. For that you should be able to set your domain's MX record to point to your machine. How and whether it can be done will depend on your hosting site. Again that will need your machine to have a name.

Ken


All times are GMT -5. The time now is 08:58 AM.