Send-only needed. Cleanest solution?

System: Ubuntu 10.04

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

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.

Or install ssmtp:

sudo apt-get install ssmtp

See: http://www.scottro.net/qnd/qnd-ssmtp.html

hybinet & melz trying both of your methods, I can get mail() to send to a gmail or yahoo account, but can't get any email sent to me@mysite.com

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?

You said that you had receiving emails "already dealt with". Is mysite.com the same domain you're talking about?

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.

Tried both mail.mysite.com and xxx.linode.com per above on both ssmtp and postfix. Still the same problem.

I can kind of see the problem. Our normal me@mysite.com emails are routed through a different location than the website. Godaddy & Linode (Don't hate me. Bosses choice. :lol:) So of course mysite.com emails originating from the website are getting spooled for local delivery that doesn't exist.

So how best to jump this hurdle? Just set the mailbox/hostname settings to Godaddy?

What do the following commands return:

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 a with 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 case, I can make hostname = Janus and FQDN = janus.site.com ?

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)

Yes, that would do. (You could also put the FQDN in the hostname.)

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!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct