Archive

Posts Tagged ‘e-mail’

fix: can’t send SMTP e-mail via OTEnet.gr when using other network

screenshot

If you have an e-mail account @otenet.gr you may find out that when connecting your laptop to another network (say you’re travelling) you can’t send SMTP e-mails.

To fix this make sure you set your STMP server settings to use SSL encryption and provide the port number 465 for connection.

If you use Outlook (Express) you can find this option at Tools/(Internet) accounts menu. Then select the OTEnet account you use and edit its settings. At the properties dialog, go to the Advanced tab and edit the SMTP settings as shown above.

You may also need to select at Servers tab that the outgoing e-mail connection needs authentication.

Another thing to keep in mind is that for incoming e-mail OTEnet uses a POP3 service at mail.otenet.gr, whereas for outgoing e-mail it uses an SMTP service at mailgate.otenet.gr (a different DNS name).

Advertisements
Categories: Posts Tags: , , , , , , , ,

Validating E-mails using Regular Expressions in Java

To sum up the discussion at http://stackoverflow.com/questions/1360113/is-java-regex-thread-safe/, you can reuse (keep in static variables) the compiled Pattern(s) and tell them to give you new Matchers when needed to validate those regex pattens against some string:


import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Validation helpers
 */ 
public final class Validators {  

  private static final String EMAIL_PATTERN = 
    "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*
     @[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$";
  
  private static Pattern email_pattern;  

  static {  
    email_pattern = Pattern.compile(EMAIL_PATTERN);
  }

  /**
   * Check if e-mail is valid 
   */   
  public static boolean isValidEmail(String email) {    
    Matcher matcher = email_pattern.matcher(email);
    return matcher.matches(); 
  }

}

(Note: the EMAIL_PATTERN string should be put in a single line)

For the RegEx pattern used, see the article at http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/ and the user comments (and useful links) posted there.

Update (20120715): previous pattern wasn’t accepting “-” in the domain name

Categories: Posts Tags: , , , ,

Kotsovolos: Case of a failed e-mail campaign

KotsovolosFail

I recently received a promotional e-mail from an e-shop I mainly use to buy home appliances in Greece that was really funny: at the top offer there was a TV, but although the e-mail had been just sent (judging from its date/time stamp) the image already had a mark “exhausted” (out of stock) on it.

Obviously it was pulling the e-mail images from the e-shop’s web server, but it’s impossible to  believe that so many clients had rushed already to buy that TV. Most probably they had too few items stocked on it, but then you don’t make that the top offer at your e-mail campaign.

Categories: Posts Tags: , , ,
%d bloggers like this: