Commands tagged sendmail (4)

  • An old USB A/B cable is all you need to make your own Smart Home hardware! Cut off and discard the B-portion of the USB cable. On the A side, connect the RED (+) and WHITE (D-) wires via a 1 kiloohm resistor. Picture: http://imgur.com/dJGVlAU Now plug the cable into a USB port on your Linux computer. Your hardware is ready! Run the above command after changing variable mysms to your personal email-to-SMS gateway info as required by your cellular service provider. The command uses the amazing usbmon tool (see link below) to detect the cable. For the curious, to view the raw usbmon output, run this command: (Also see the sample output) usbmon -i usb0 How does it work? When the red and white wires are connected (via the 1 kiloohm resistor) the USB hardwere is tricked into thinking that a new USB device is trying to start up. We then use the usbmon utility to capture the host USB events as it tries to talk to the cable. The expect utility watches the usbmon stream and waits for the disconnect text "-2:128" before sending the SMS message. Finally, the sendmail tool is used to email the SMS message to your smartphone via your cellular provider's SMS-to-email gateway. As a result, when the electrical connection between the red and white wire is interrupted, or the USB cable is unplugged from your computer, you get an SMS notification of the disconnect event on your smartphone. Could this be the cheapest smart home gadget ever? What are YOU going to sense with it? Please let me know in the comments and please don't forget to click it up! Links: http://www.linuxcertif.com/man/8/usbmon/ http://en.wikipedia.org/wiki/USB#Pinouts http://imgur.com/dJGVlAU Show Sample Output


    5
    mysms='xxx0001234@messaging.sprintpcs.com' ; expect -c "log_user 0 ; set timeout -1 ; spawn usbmon -i usb0 ; expect -re \"C.*Ii.*-2:128\" { spawn sendmail $mysms ; send \"Smart Home Sensor Triggered\n.\n\" ; expect }"
    omap7777 · 2015-05-02 06:10:10 14
  • test if sendmail is installed and working. Show Sample Output


    1
    echo "Subject: test" | /usr/lib/sendmail -v me@domain.com
    guillaume1306 · 2018-11-12 11:51:33 409
  • This will send the web page at $u to recipient@example.com . To send the web page to oneself, recipient@example.com can be replaced by $(whoami) or $USER. The "charset" is UTF-8 here, but any alternative charset of your choice would work. `wget -O - -o /dev/null $u` may be considered instead of `curl $u` . On some systems the complete path to sendmail may be necessary, for instance /sys/pkg/libexec/sendmail/sendmail for some NetBSD.


    -1
    { u="http://twitter.com/commandlinefu"; echo "Subject: $u"; echo "Mime-Version: 1.0"; echo -e "Content-Type: text/html; charset=utf-8\n\n"; curl $u ; } | sendmail $USER
    pascalvaucheret · 2010-02-24 04:18:30 5

  • -3
    cat file.txt | sendmail -F myname -f admin@mysite.com guest@guest.com
    kev · 2011-09-18 11:35:35 47

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

force unsupported i386 commands to work on amd64
The above was done using the i386 flashplayer plugin, and was installed on a AMD64 machine running an AMD64 kernel and AMD64 programs. the resulting plugin install ultimately didn't work for swiftfox (but worked for iceweasel) without also covering it with a nspluginwrapper which took a bit of fenangaling to get to work (lots of apt-getting) but it is a nice feature to be able to trick installers that think you need i386 into running on a amd64, or at least attempting to run on amd64. Enjoy

Gets the english pronunciation of a phrase
Usage examples: say hello say "hello world" say hello+world

Generat a Random MAC address
Generate a random MAC address with capital letters

Extract tarball from internet without local saving

Check whether laptop is running on battery or cable
The original proc file doesn't exist on my system.

Install pip with Proxy
Installs pip packages defining a proxy

Send a local file via email
This just reads in a local file and sends it via email. Works with text or binary. *Requires* local mail server.

dont execute command just add it to history as a comment, handy if your command is not "complete" yet

list files recursively by size

Get the IP address
gives u each configured IP in a seperate line.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: