Send-only needed. Cleanest solution?
OK, based on my fail with the send-only Exim issue, I'm obviously n00b about installing email solutions. So let's start from the beginning.
I'm looking for the simplest install that will allow my mail() commands to work. I don't need a full blown send/receive/calendar/lollipopholder. Receiving our emails is already dealt with.
Looking at the email guides (multiple installs of postfix, citadel, etc. etc.) I've already tried basic Postfix and Exim installs, and failed with both.
So what's the cleanest solution to my problem? Any recommendations.
12 Replies
1. Remove all other e-mail sending programs, like exim and sendmail-mta. Afterward, run "top" or to verify that these programs are not running. Sometimes they keep running even after you remove them.
2. Run the following commands, one by one. Don't copy and paste all three lines at the same time. If Postfix asks questions, just keep pressing Enter.
apt-get install --reinstall postfix
postconf -e "inet_interfaces = loopback-only"
/etc/init.d/postfix restart
3. There is no step 3.
Edit: clarification in step 2.
sudo apt-get install ssmtp
See:
Which places me in the same problem I was having using the send-only Exim attempt.
Quite simply, I'd like to be able to make a contact page that can send us an internal email. Once that's done, I'm ASSuming sending automated emails via website to customers will be easy also. (Seems the 2nd part is the easiest. Not sure why the 1st part's such a pain.)
Anybody?
What does Postfix (or exim, or ssmpt) think its hostname is? If it is the same as mysite.com, that could be the reason why it's not properly handling e-mails bound to mysite.com.
If you used Postfix as I suggested, relevant entries can be found in /etc/postfix/main.cf in the "myhostname" and "mydestination" lines, as well as in /etc/mailname. Not sure where they are in ssmtp.
If mysite.com is in there, try changing it to a subdomain (such as mail.mysite.com), or something unrelated to the domain (such as the default reverse DNS entry of liXX-YYY.members.linode.com). Obviously, you should use a subdomain that actually points to your IP address. Wait until the DNS propagates, restart Postfix and try again.
I can kind of see the problem. Our normal
So how best to jump this hurdle? Just set the mailbox/hostname settings to Godaddy?
hostname
hostname -f
cat /etc/hosts
telnet localhost 25
… as well as 'dig -x 192.0.2.1', with your IP address instead of the example IP?
If ANY of them (or your mail server's configuration file) have your bare domain name (mysite.com), that is your problem. A mail server will not try to connect to a mail server for mysite.com if it thinks it is mysite.com, and there is nothing you can do aside from make sure nothing on your system would lead it to believe it is mysite.com.
Also, if that was the case and you did change your hostname, a reboot is sometimes helpful to get everything on the same page.
@hoopycat:
If ANY of them (or your mail server's configuration file) have your bare domain name (mysite.com), that is your problem.
Yeah that's obviously the problem I'm running into. However, if I change the hostname, what's the easiest way to do it so that I don't break every other portion of my website? (I.E. every app where the config files points to the "current" hostname)
@josh-chs:
However, if I change the hostname, what's the easiest way to do it so that I don't break every other portion of my website? (I.E. every app where the config files points to the "current" hostname)
Generally speaking, web servers and web apps don't give a damn about the hostname of the machine they're on. For example, if you have awith ServerName mysite.com and ServerAlias www.mysite.com , it will continue to work just fine after you've changed your hostname.
On Debian & Ubuntu systems, you can change the hostname by:
Step 1. Edit /etc/hostname (just type your new hostname and save)
Step 2. /etc/init.d/hostname.sh start
Step 3. Edit /etc/hosts (change any entries pointing to the old hostname)
Make sure you use a fully qualified domain name as your hostname, e.g. "subdomain.example.com" instead of "subdomain".
So, in this example:
Step 1. Edit /etc/hostname janus
Step 2. /etc/init.d/hostname.sh start
Step 3. Edit /etc/hosts (change any entries to janus.site.com)
And this would help clear my email problem, without causing problems w/ SQL, etc.? (well SQL bad example, but you get what I mean)
In /etc/hosts, only change entries that actually contains site.com. Leave other entries alone, e.g. localhost and IPv6 settings.
SQL doesn't care. Your web app only ever connects to localhost, right?
@hybinet:
Your web app only ever connects to localhost, right?
Great question. I've only recently inherited this site, and haven't been able to comb through it completely yet.
In short, no clue.
@hybinet:
I'll use Postfix in this example, because that's what I'm used to:
1. Remove all other e-mail sending programs, like exim and sendmail-mta. Afterward, run "top" or to verify that these programs are not running. Sometimes they keep running even after you remove them.
2. Run the following commands, one by one. Don't copy and paste all three lines at the same time. If Postfix asks questions, just keep pressing Enter.
apt-get install --reinstall postfix postconf -e "inet_interfaces = loopback-only" /etc/init.d/postfix restart
3. There is no step 3.
Edit: clarification in step 2.
I just wanted to say thank you for posting these steps. Like OP, I was also looking for a simple program to send emails and didn't need to configure anything fancy (mysql, dovecot etc) since I'm using Google Apps for emails. I followed your steps and it worked great!