Commands tagged smtp (7)

  • This command will start a simple SMTP server listening on port 1025 of localhost. This server simply prints to standard output all email headers and the email body.


    76
    python -m smtpd -n -c DebuggingServer localhost:1025
    jemerick · 2009-02-05 16:50:44 87
  • Required curl version >=7.21; using ~/.netrc for authorization


    14
    curl -n --ssl-reqd --mail-from "<user@gmail.com>" --mail-rcpt "<user@server.tld>" --url smtps://smtp.gmail.com:465 -T file.txt
    mitry · 2010-10-03 15:44:53 20
  • Allows you to connect to an SMTP server over TLS, which is useful for debugging SMTP sessions. (Much like telnet to 25/tcp). Once connected you can manually issue SMTP commands in the clear (e.g. EHLO) Show Sample Output


    7
    openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25
    realist · 2009-08-19 08:37:24 5
  • I use this as an alias: alias authplain "printf '\!:1\0\!:1\0\!:2' | mmencode | tr -d '\n' | sed 's/^/AUTH PLAIN /'" then.. # authplain someuser@somedomain.com secretpassword AUTH PLAIN c29tZXVzZXJAc29tZWRvbWFpbi5jb20Ac29tZXVzZXJAc29tZWRvbWFpbi5jb20Ac2VjcmV0cGFzc3dvcmQ= # Show Sample Output


    4
    printf '\!:1\0\!:1\0\!:2' | mmencode | tr -d '\n' | sed 's/^/AUTH PLAIN /'
    vwal · 2009-08-04 05:04:50 4
  • Note, this works because smtp is running


    2
    mailx bar@foo.com -s "HTML Hello" -a "Content-Type: text/html" < body.htm
    ethanmiller · 2009-05-19 04:49:26 5
  • Lots of scripts show you how to use socat to send an email to an SMTP server; this command actually emulates an SMTP server! It assumes the client is only sending to one recipient, and it's not at all smart, but it'll capture the email into a log file and the client will stop retrying. I used this to diagnose what emails were being sent by cron and subsequently discarded, but you can use it for all sorts of things. Show Sample Output


    1
    socat TCP4-LISTEN:25,fork EXEC:'bash -c \"echo 220;sleep 1;echo 250;sleep 1;echo 250;sleep 1;echo 250;sleep 1;echo 354;sleep 1;echo 250; timeout 5 cat >> /tmp/socat.log\"'
    pfudd · 2014-11-26 21:14:05 15

  • 0
    authplain() { echo -n "AUTH PLAIN "; echo -n \\0$1\\0$2\\0 | base64; }
    danky · 2014-11-26 15:24:08 8

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

List all NPM global packages installed

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Use Linux coding style in C program
put "-linux" option into $HOME/.indent.pro to make it default

Set OS X X11 to use installed Mathematica fonts

drop first column of output by piping to this

Capture FTP Credentials and Commands

output length of longest line
If your wc does not have the -L option, you can use awk.

multiline data block parse and CSV data extraction with perl
extract data in multiline blocks of data with perl pattern matching loop

Kill all processes belonging to a user

Google URL shortener
Shorter and made into a function.


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: