[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Command-lineMail Client?



on Wed, Nov 01, 2000 at 11:20:26AM -0400, Casey Henderson (Casey@umit.maine.edu) wrote:
> Hello all,
>    I am looking for a good command-line mail client that I can use from
> a shell script.  Here's what I'm trying to do:

Paragraphs are good, Casey.  Whitespace is cheap.

> I have an FTP server and an SSH server set up on my Linux box at home. 
> I use a dial-up PPP connection to connect to the internet.  I want to
> be able to log into my computer from school (I attend college about 20
> mins away from my house).  I have pppd set up to redial my ISP if it
> gets disconnected.  

> The problem, as you may have guessed, is my IP address will change.
> What I want to do is set up a little script that can dial my ISP,
> figure out my IP, and email it to my school email account.  Then I can
> check my email from school, see what my IP is, and log into my Linux
> box.  

I've done similar configurations.  Your problem isn't the mail client,
it's your MTA (mail transfer agent), most likely Exim, Postfix, 
Qmail, Sendmail, or similar.

My own solutions have been:

  - Email notification periodically to known accounts.
  - Posting the current IP (and most recent update time) every ten
    minutes to a known web site.

I currently use the latter.

> I have the first two parts working fine (the dialup and figuring out
> my IP).  I cannot figure out how to send the email.  I tried to use
> the built-in "mail" command, but it did not work.  For some odd
> reason, it won't send mail to an external host.  It will only mail to
> local user accounts on my machine.  

For mail:

    /sbin/ifconfig ppp0 | grep inet | cut -f 2 -d: | cut -f 1 -d' ' |
       mailx -s "IP" me@mydom.foo

Should post the message.

What you need to do is configure your local MTA to send this either
directly to the destination, or more likely, to your ISP's SMTP relay,
usualy referred to as a smarthost.

For the ftp version, I use a ~/.netrc file and set of scripts to post
the above IP information and a timestamp to a page.  Scripts attached.

> I have a firewall set up that will allow me to log in to my computer

Irrelevant.

-- 
Karsten M. Self <kmself@ix.netcom.com>     http://www.netcom.com/~kmself
 Evangelist, Opensales, Inc.                    http://www.opensales.org
  What part of "Gestalt" don't you understand?      There is no K5 cabal
   http://gestalt-system.sourceforge.net/        http://www.kuro5hin.org
#!/bin/sh

ftp_remote=<some website IP>

echo '
cd www
ascii
put |/usr/local/bin/ip-html ip.html' | ftp -vip $ftp_remote
#!/bin/sh
# Get current dynamic IP 

/sbin/ifconfig ppp0 2>/dev/null | grep inet | awk '{ print $2 }'

Attachment: pgpvoudrn2MCr.pgp
Description: PGP signature


Reply to: