Posts Tagged ‘email’

email notification from a script

June 15, 2016 Leave a comment

I have a Digital Ocean VPS box where several scripts are running. Some of them run for a day. I would like to get an email notification when a particular script starts / ends, or when something happens.

In short: how to send an email from the command line?

First, do the necessary configuration to be able to send emails from the command line (more details here).

Sending email without a body:

mailx -s "subject" < /dev/null "" 2>/dev/null

Sending email with a body:

echo 'this is the body of the email' | mailx -s "subject" "" 2>/dev/null

I also made a Python wrapper for it that you can find here.

Categories: bash, python Tags: ,

Automate with IFTTT

IFTTT is a great service that enables users to connect different web applications (e.g., Facebook, Evernote, Weather, Dropbox, etc.) together through simple conditional statements known as “Recipes”.” (via wikipedia)

IFTTT stands for “if this then that”. That is, if a condition is met, then an action is triggered.

Here is a nice introductory video. It shows how to get an SMS if it’s going to rain tomorrow:


Let’s see another example. Say you have a favourite TV show that you want to watch as soon as possible. When the new episode is out, you want to get an email notification.

As reddit user ACreatureVoidOfForm pointed out, we need and “Create a page on showrss for all the shows you watch and generate an RSS feed. Create a rule on ifttt to email you when a new entry is added to the feed.” (tip from here)

send an email at a specific date and time

Update (20140512): There is a better way. Check out this post.

I have a favorite TV show whose new episodes I want to watch as soon as possible. However, I don’t want to keep in my mind the release dates. When a new episode is out, I want to get an email notification.

At you can check out the release dates of the episodes (example). LetterMeLater provides a service to send emails at a specific date and time (it’s free up to 30 emails/month). To the release dates I added one day and set LetterMeLater to send emails at that day.

It may not be the best way to do it. If you have a better method, let me know.

Categories: Uncategorized Tags: , , ,

Check Why your Email was Delivered Late

October 6, 2012 Leave a comment

Amit Agarwal wrote a great post on how to analyze why your email was delivered late.

In short:

  • get the original email message (“show original”)
  • copy the whole header and insert it in this application: MessageHeader Google Apps Toolbox
  • it will analyze and show you where the delay occurred
Categories: google Tags: , ,

Email and website

March 19, 2011 Leave a comment

‘The AP Stylebook, the de facto style and usage guide for much of the news media, announced on Friday that the abbreviated term for “electronic mail” is losing a hyphen, and with it, a relic of a simpler time when Internet technology needed to be explained very carefully.

The move follows the AP Stylebook’s decision to change “Web site” to “website” last year…’

Read the whole story here.

Send link button in Firefox

January 6, 2011 1 comment


When you browse the Web, you encounter articles quite often that could be interesting for your friends too. How to send them these links in a fast and painless way?


Install the Send Link button add-on for Firefox. It’s a “trivial extension to add a toolbar button to trigger Firefox’s built-in Send Link… menu…”

Combine it with Gmail

If you have a Gmail account, you can set Gmail in Firefox as the default e-mail client. Then, when you click on a mailto: link, Gmail will open automatically.

Steps to follow: in Firefox, go to Preferences. Choose the Application tab and type in “mailto”. Under Action, choose Use Gmail. Done.

Categories: firefox Tags: , , ,

Validate an e-mail address in PHP [PHP]

November 23, 2010 Leave a comment


You have an input form with an “e-mail address” field and you want to validate the user input. You want a simple solution that checks if the e-mail is well-formed or not.


// from wordpress code: wp-includes/formatting.php
function is_email($user_email) 
	$chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i";

	if (strpos($user_email, '@') !== false && strpos($user_email, '.') !== false) 
		if (preg_match($chars, $user_email)) {
			return true;
		} else {
			return false;
	} else {
		return false;


I found this solution here in a comment.

Categories: php Tags: ,