sendmail from the command line in GoDaddy

This is another useful tidbit to use with the article, Backing up your Database (with GoDaddy and Cron).

What it does: Allow you to send mail to a specified email address by using the program sendmail.

You do this from the shell in your GoDaddy account. I shouldn’t have to tell you that this tutorial is meant for the shared Linux hosting account.

/usr/sbin/sendmail.real -f myaccount@theurl.com
intendedrecipient@theotherurl.com

Type that all on one line. Of course, change the addresses to suit your needs, then press <enter>. You’ll be greeted with… nothing happening. sendmail is now waiting for further instructions. So type the following.

Subject: whatever your subject is
And now you type your message below that

And you’ll still be left with nothing happening. Now sendmail is waiting for you to tell it that the message is over. So simply type a period on a line by itself.

.

And press <enter>. Your message should now send.

This is handy for a cron job where you want either a receipt that the cron job completed, or perhaps you want a file (backup?) sent to you on a regular basis.

Example:

/usr/sbin/sendmail.real \
-f test@example.com \
recipient@example.com
Subject: Testing for HowTo
This is just a test message.
And this is a new line.
.

The following email is what I received.

from test@example.com
to
date Mon, Apr 20, 2009 at 2:22 PM
subject Testing for HowTo
mailed-by bounce.secureserver.net
This is just a test message.
And this is a new line.

2 Responses to “sendmail from the command line in GoDaddy”

  1. Michael says:

    Is there a way to do this on a single line?

  2. kdnewton says:

    @Michael
    Potentially. If there is, it’s beyond my interest. I found after writing this that there’s already an option to send alerts from the GoDaddy Cron control panel. Kind of removes the need for this.

Leave a Reply

 

Staypressed theme by Themocracy