Use another SMTP server with Postfix

Over the weekend, I finally installed and configured my own e-mail server. What a challenge that was!

I’m successfully running Postfix, Dovecot, Spamassassin, Amavisd-new, ClamAV, SQLgrey, and Squirrelmail. I, however, encountered problems sending to Gmail.

It returned with the following message:

host gmail-smtp-in.l.google.com[64.233.163.27] said:
550-5.7.1 [76.170.212.236] Our system has detected an unusual amount of unsolicited 550-5.7.1 mail originating from your IP address. To protect our
550-5.7.1 users from spam, mail sent from your IP address has been 550-5.7.1 rejected. Please visit 550-5.7.1
http://www.google.com/mail/help/bulk_mail.html to review 550 5.7.1 our Bulk Email Senders Guidelines. 39si20019987nzk (in reply to end of DATA command)

Rejected? Huh? Apparently, my IP address has been blacklisted because Google couldn’t identify my server; also because I don’t have a static IP.

They said:

To ensure that Gmail can identify you:

  • Use a consistent IP address to send bulk mail.
  • Keep valid reverse DNS records for the IP address(es) from which you send mail, pointing to your domain.
  • Use the same address in the ‘From:’ header on every bulk mail you send.

We also recommend publishing an SPF record, and signing with DomainKeys.

At this point, I don’t really want to run and maintain my own DNS server nor obtain a static IP (everything works fine and it’s cheaper!), so I found a way around it: Set Postfix to use another SMTP server.

Here’s how:

1. Edit /etc/postfix/main.cf, and add or edit this line:

relayhost = smtp.servertouse.com

2. Restart the Postfix service (I run FC6), so:

sudo service postfix restart

That’s it! Your server will now send to the SMTP server specified above rather than sending directly to the destination, which as a result, will not be “rejected” by Gmail or the like. ;0)

What to check when encountering Exchange user name and password errors

A C# web app I’m developing requires pulling (and deleting already read e-mails) from an Exchange 2003 server.  I used the POP3 code that I actually shared/posted about yesterday; however, I was getting this error, though I had the correct user name and password:

-ERR Logon failure: unknown user name or bad password.

It was getting to be very annoying, so I googled for any answers and found out that setting up an Exchange alias was (sort of like) a requirement to get the issue resolved.

Here were the questions and needed settings I had to check on the Exchange 2003 server:

  • Do the accounts have an email address, i.e., username@ad_domain?
  • Do the accounts have the POP3/IMAP protocols enabled?  They can be set to on or off on a per-account basis – default is on?
  • Are the Exchange Alias and account user name the same for all accounts?

I had bullet’s #1 and #2 set – but not bullet #3!

So if all else fails, check that setting out if you encounter POP3/IMAP user name/password errors.  =0)

Mac OS X verbose mode on boot

If you, like me, come from a strong Linux background and have recently migrated to Mac OS X, then I think you’ll really find this tip helpful.

As you may know, the OS X boot sequence details is hidden from the user by default; you basically only see the Apple logo and a load status bar. 

Well, when used to Linux’s very detailed boot sequence, you kinda look for the same thing in any operating system, especially with OS X since it’s practically a *nix variant, i.e., Darwin.

So googling for more info, I found 2 ways to handle this:

  1. On the fly (non-permanent) – To see it only when you want to, hold down CMD + v after you’ve hit the power button.  Hold it down just until you see the text on the screen.
  2. Permanent – To see it every time OS X boots, do the following:
    1. Open a terminal window.
    2. Type and execute sudo nvram boot-args=”-v”.
    3. Reboot your computer.

That’s it!  Option #2, BTW, can be rolled-back, so don’t worry.

‘Till my next post, take it easy.  =0)

Get rid of those pesky Windows startup programs

Numerous companies over the years have joined the computer-industry bandwagon and have added their own quick launch and/or startup shortcuts of their applications in Windows.  

Though their intent is good, it most of the time results in system slowdowns and user unproductivity.  What happens is system resources, i.e., memory, are used unnecessarily that could otherwise be used in some other, more efficient, way like playing graphic-intensive games.  =0)

So in this post, I’ll show you techniques I implement to get rid of the pesky startup programs.

  1. Startup folder – Check what’s in this folder; anything in here “starts up” whenever Windows boots. 
    1. In Windows XP, simply right-click the Start button and go to Explore All UsersNote: You must be an administrator to do this.
    2. Then go to Programs > Startup.
    3. Delete or move out the applications that you believe you don’t need, since these are normally shortcuts to the actual application only. 
  2. MSConfig – This built-in Windows boot configuration utility allows you to modify what programs should startup, edit configuration files, and modify Windows Services. 
    1. To access, go to Run.
    2. Type msconfig then OK.
    3. In this post, we only want to modify anything/everything only in the Startup tab.
    4. So navigate to the Start tab and uncheck what you don’t need.  Again, search Google to find out if it’s needed.
  3. Windows Registry‘s RUN subfolder – Some programs add their executable in here too.  You only want to go in here if the MSConfig steps above don’t resolve your problem.  Be warned that modifying the registry is not recommended unless you know what you are doing.
    1. To access, go to Run like step #1 in MSConfig.
    2. Type regedit then OK.
    3. Navigate to HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows > CurrentVersion > Run.
    4. Before deleting anything in here, search Google to make sure you don’t need it.  Also, backup the whole Run subfolder just in case.
  4. Preferences or Properties of the app – If all else fails, you can access and disable the system startup options through the application itself; for example, Yahoo! Messenger.
    1. Login into Yahoo! Messenger.
    2. Then go to Messenger > Preferences > General.
    3. Uncheck the Automatically start Yahoo! Messenger option, which is under When I start up my computer.

That’s pretty much it.  There are tools out there that you can also use, but I’d rather try the steps above first, as they might install their own quick launch or startup to their program themselves.  =0)

Put your Mac to sleep via e-mail

You’re at work, with no remote control access/capability to your Mac at home, brown-outs are occurring, and you forgot to plug it into a power strip due to some unknown reason last night.  What do you do?  Well, read on…

With some preparation, you can take advantage of Apple’s Mail‘s rules feature to run an AppleScript on a filtered message next time.  Here’s how:

  1. Type this script using the Script Editor:
  2. tell application “Finder”

    display dialog “This computer will go to sleep in 1 minute.”  buttons {“Sleep”, “Cancel”} default button 2 giving up after 60

    sleep

    end tell

  3. Save the file somewhere.  I suggest Documents/Scripts (create the folder if it doesn’t exist and start saving all your useful scripts in here).
  4. Open up Apple Mail and navigate to Preferences > Rules > Add Rules.
  5. Copy and setup the following rules based on the screenshot below:
  6. Fig. 1.1 – Apple Mail’s Add Rule window

    Apple Mail rules

  7. Apply the changes and minimize Apple Mail.
  8. That’s it!  All you have to do now is send yourself an e-mail with “Sleep My Mac” as the subject with the message of “Go to sleep” from anywhere.

One caveat: For this to work, Apple Mail will need to be running (minimized is fine). 

Hopefully, you find this tip helpful and empowering.  Now back to work!  =0)