<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: mail code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 07 Sep 2008 16:23:58 GMT</pubDate>
    <description>DZone Snippets: mail code</description>
    <item>
      <title>Optimizing Mac OS X Mail.app</title>
      <link>http://snippets.dzone.com/posts/show/5865</link>
      <description>From &lt;a href="http://www.ffnn.nl/pages/articles/apple-mac-os-x/optimizing-mail.app-performance.php"&gt;Forever For Now&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;Mail stores a so-called Envelope Index which contains cross references between message subjects, contents and other interesting aspects. Over time, this index becomes less and less efficient and slows down Mail. &lt;br /&gt;&lt;br /&gt;The following action performed in the Terminal will clean up Mail's internal database, saving disk space and speeding up the application.&lt;br /&gt;&lt;br /&gt;* Quit Mail from the menu or using Apple + Q and wait until the black arrow disappears from Mail's Dock icon.&lt;br /&gt;* Open up Terminal using Spotlight via Alt + Space or start it from the Applications/Utilities folder.&lt;br /&gt;* Type or copy the following line into the Terminal window:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sqlite3 ~/Library/Mail/Envelope\ Index vacuum;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 02 Aug 2008 02:05:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5865</guid>
      <author>jeffreybarke (Jeffrey Barke)</author>
    </item>
    <item>
      <title>Retrieve your Gmail messages as an XML feed</title>
      <link>http://snippets.dzone.com/posts/show/5097</link>
      <description>This Ruby example shows how to retrieve your most recent email as an atom XML feed from the Google Apps website.  &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require 'rubygems'&lt;br /&gt;require 'httpclient'&lt;br /&gt;&lt;br /&gt;url = "https://mail.google.com/a/yourwebsite.com/feed/atom"&lt;br /&gt;client = HTTPClient.new&lt;br /&gt;client.debug_dev = STDOUT if $DEBUG&lt;br /&gt;client.set_auth(url, 'yourname@yourwebsite.com', 'yourpassword')&lt;br /&gt;resp = client.get(url)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Note: You might require to gem install httpclient.</description>
      <pubDate>Sun, 03 Feb 2008 16:29:06 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5097</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Using POP3 to Retrieve Email for Rails App</title>
      <link>http://snippets.dzone.com/posts/show/4214</link>
      <description>Put this in a file called "inbox" in the scripts/ directory of your Rails app. change the host, username, and password to match.&lt;br /&gt;&lt;br /&gt;Set up a cron job to run this script every so often (frequency depends on your needs).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby&lt;br /&gt;&lt;br /&gt;require 'net/pop'&lt;br /&gt;require File.dirname(__FILE__) + '/../config/environment'&lt;br /&gt;&lt;br /&gt;logger = RAILS_DEFAULT_LOGGER&lt;br /&gt;&lt;br /&gt;logger.info "Running Mail Importer..." &lt;br /&gt;Net::POP3.start("localhost", nil, "username", "password") do |pop|&lt;br /&gt;  if pop.mails.empty?&lt;br /&gt;    logger.info "NO MAIL" &lt;br /&gt;  else&lt;br /&gt;    pop.mails.each do |email|&lt;br /&gt;      begin&lt;br /&gt;        logger.info "receiving mail..." &lt;br /&gt;        Notifier.receive(email.pop)&lt;br /&gt;        email.delete&lt;br /&gt;      rescue Exception =&gt; e&lt;br /&gt;        logger.error "Error receiving email at " + Time.now.to_s + "::: " + e.message&lt;br /&gt;      end&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;logger.info "Finished Mail Importer." &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 26 Jun 2007 17:40:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4214</guid>
      <author>timmorgan (Tim Morgan)</author>
    </item>
    <item>
      <title>Ultra-simplistic Ruby SMTP server</title>
      <link>http://snippets.dzone.com/posts/show/3932</link>
      <description>You'll know if you need this, otherwise steer clear ;-)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;require 'gserver'&lt;br /&gt;&lt;br /&gt;class SMTPServer &lt; GServer&lt;br /&gt;  def serve(io)&lt;br /&gt;    @data_mode = false&lt;br /&gt;    puts "Connected"&lt;br /&gt;    io.print "220 hello\r\n"&lt;br /&gt;    loop do&lt;br /&gt;      if IO.select([io], nil, nil, 0.1)&lt;br /&gt;	      data = io.readpartial(4096)&lt;br /&gt;	      puts "&gt;&gt;" + data&lt;br /&gt;	      ok, op = process_line(data)&lt;br /&gt;	      break unless ok&lt;br /&gt;	      io.print op&lt;br /&gt;      end&lt;br /&gt;      break if io.closed?&lt;br /&gt;    end&lt;br /&gt;    io.print "221 bye\r\n"&lt;br /&gt;    io.close&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  def process_line(line)&lt;br /&gt;    if (line =~ /^(HELO|EHLO)/)&lt;br /&gt;      return true, "220 and..?\r\n"&lt;br /&gt;    end&lt;br /&gt;    if (line =~ /^QUIT/)&lt;br /&gt;      return false, "bye\r\n"&lt;br /&gt;    end&lt;br /&gt;    if (line =~ /^MAIL FROM\:/)&lt;br /&gt;      return true, "220 OK\r\n"&lt;br /&gt;    end&lt;br /&gt;    if (line =~ /^RCPT TO\:/)&lt;br /&gt;      return true, "220 OK\r\n"&lt;br /&gt;    end&lt;br /&gt;    if (line =~ /^DATA/)&lt;br /&gt;      @data_mode = true&lt;br /&gt;      return true, "354 Enter message, ending with \".\" on a line by itself\r\n"&lt;br /&gt;    end&lt;br /&gt;    if (@data_mode) &amp;&amp; (line.chomp =~ /^.$/)&lt;br /&gt;      @data_mode = false&lt;br /&gt;      return true, "220 OK\r\n"&lt;br /&gt;    end&lt;br /&gt;    if @data_mode&lt;br /&gt;      puts line &lt;br /&gt;      return true, ""&lt;br /&gt;    else&lt;br /&gt;      return true, "500 ERROR\r\n"&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;a = SMTPServer.new(1234)&lt;br /&gt;a.start&lt;br /&gt;a.join&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 29 Apr 2007 05:52:52 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3932</guid>
      <author>peter (Peter Cooperx)</author>
    </item>
    <item>
      <title>Authenticate with SMTP server before sending email</title>
      <link>http://snippets.dzone.com/posts/show/3328</link>
      <description>For more info see: http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html&lt;br /&gt;&lt;br /&gt;You need activation.jar, smtp.jar, and mailapi.jar in your classpath for this to work.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;&lt;br /&gt;import javax.mail.Message;&lt;br /&gt;import javax.mail.MessagingException;&lt;br /&gt;import javax.mail.PasswordAuthentication;&lt;br /&gt;import javax.mail.Session;&lt;br /&gt;import javax.mail.Transport;&lt;br /&gt;import javax.mail.internet.InternetAddress;&lt;br /&gt;import javax.mail.internet.MimeMessage;&lt;br /&gt;import javax.mail.internet.MimeMessage.RecipientType;&lt;br /&gt;&lt;br /&gt;public class MailWithPasswordAuthentication {&lt;br /&gt;	public static void main(String[] args) throws MessagingException {&lt;br /&gt;		new MailWithPasswordAuthentication().run();&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	private void run() throws MessagingException {&lt;br /&gt;		Message message = new MimeMessage(getSession());&lt;br /&gt;&lt;br /&gt;		message.addRecipient(RecipientType.TO, new InternetAddress("to@example.com"));&lt;br /&gt;		message.addFrom(new InternetAddress[] { new InternetAddress("from@example.com") });&lt;br /&gt;&lt;br /&gt;		message.setSubject("the subject");&lt;br /&gt;		message.setContent("the body", "text/plain");&lt;br /&gt;&lt;br /&gt;		Transport.send(message);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	private Session getSession() {&lt;br /&gt;		Authenticator authenticator = new Authenticator();&lt;br /&gt;&lt;br /&gt;		Properties properties = new Properties();&lt;br /&gt;		properties.setProperty("mail.smtp.submitter", authenticator.getPasswordAuthentication().getUserName());&lt;br /&gt;		properties.setProperty("mail.smtp.auth", "true");&lt;br /&gt;&lt;br /&gt;		properties.setProperty("mail.smtp.host", "mail.example.com");&lt;br /&gt;		properties.setProperty("mail.smtp.port", "25");&lt;br /&gt;&lt;br /&gt;		return Session.getInstance(properties, authenticator);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	private class Authenticator extends javax.mail.Authenticator {&lt;br /&gt;		private PasswordAuthentication authentication;&lt;br /&gt;&lt;br /&gt;		public Authenticator() {&lt;br /&gt;			String username = "auth-user";&lt;br /&gt;			String password = "auth-password";&lt;br /&gt;			authentication = new PasswordAuthentication(username, password);&lt;br /&gt;		}&lt;br /&gt;&lt;br /&gt;		protected PasswordAuthentication getPasswordAuthentication() {&lt;br /&gt;			return authentication;&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Fri, 19 Jan 2007 00:55:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3328</guid>
      <author>mikehale (Michael Hale)</author>
    </item>
    <item>
      <title>&#232;&#381;&#183;&#229;?&#8211;Exchange&#230;&#339;&#170;&#232;&#175;&#187;&#233;&#8218;&#174;&#228;&#187;&#182;&#230;&#8226;&#176;</title>
      <link>http://snippets.dzone.com/posts/show/2820</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;private int GetUnReadMailCount()&lt;br /&gt;{&lt;br /&gt;string url=&#226;&#8364;&#339;http://mail.felixwoo.com/exchange/&#226;&#8364;?; //&#230;&#338;&#8225;&#229;&#174;&#353;Exchange&#230;&#339;?&#229;&#352;&#161;&#229;&#8482;&#168;&#229;&#339;&#176;&#229;?&#8364; &lt;br /&gt;System.Net.HttpWebRequest Request;&lt;br /&gt;System.Net.WebResponse Response;&lt;br /&gt;System.Net.CredentialCache MyCredentialCache;&lt;br /&gt;string strUserName = &#226;&#8364;&#339;wuf&#226;&#8364;?; //&#230;&#338;&#8225;&#229;&#174;&#353;&#231;&#8482;&#187;&#229;&#189;&#8226;&#231;&#353;&#8222;&#231;&#8221;&#168;&#230;&#710;&#183;&#229;??&lt;br /&gt;string strRootURI = url+strUserName ; //&#229;&#190;&#8212;&#229;&#710;&#176;&#232;&#166;?&#232;&#174;&#191;&#233;&#8212;&#174;&#233;&#8218;&#174;&#231;&#174;&#177;&#231;&#353;&#8222;WebDAV&#229;&#339;&#176;&#229;?&#8364;&lt;br /&gt;string strPassword = &#226;&#8364;&#339;123456&#226;&#8364;?; //&#230;&#338;&#8225;&#229;&#174;&#353;&#232;&#175;&#165;&#231;&#8221;&#168;&#230;&#710;&#183;&#231;&#353;&#8222;&#229;&#175;&#8224;&#231;&#160;?&lt;br /&gt;string strDomain = &#226;&#8364;&#339;felixwoo.com&#226;&#8364;?; //&#230;&#338;&#8225;&#229;&#174;&#353;&#229;&#376;&#376;&#229;??&lt;br /&gt;string strQuery ="";&lt;br /&gt;byte[] bytes = null;&lt;br /&gt;System.IO.Stream RequestStream = null;&lt;br /&gt;System.IO.Stream ResponseStream = null;&lt;br /&gt;XmlDocument ResponseXmlDoc = null;&lt;br /&gt;XmlNodeList HrefNodes= null;&lt;br /&gt;XmlNodeList SizeNodes= null;&lt;br /&gt;int count=0;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;  // &#231;&#8221;&#168;SQL&#230;&#376;&#165;&#232;&#175;&#162;WebDAV&#232;&#191;&#8221;&#229;&#8250;&#382;&#231;&#187;&#8220;&#230;&#382;&#339;&#228;&#184;&#173;&#231;&#353;&#8222;unreadcount&#232;&#352;&#8218;&#231;&#8218;&#185;.&lt;br /&gt;  strQuery = "&lt;?xml version=\"1.0\"?&gt;&lt;D:searchrequest xmlns:D = \"DAV:\" &gt;"&lt;br /&gt;   + "&lt;D:sql&gt;SELECT \"DAV:displayname\",\"urn:schemas:httpmail:unreadcount\" FROM \"" + strRootURI + "\""&lt;br /&gt;   + "&lt;/D:sql&gt;&lt;/D:searchrequest&gt;";&lt;br /&gt;&lt;br /&gt;  // &#229;&#710;&#8250;&#229;&#187;&#186;&#230;&#8211;&#176;&#231;&#353;&#8222;CredentialCache&#229;&#175;&#185;&#232;&#177;&#161;&#239;&#188;&#338;&#230;&#382;&#8222;&#229;&#187;&#186;&#232;&#186;&#171;&#228;&#187;&#189;&#229;&#8225;&#173;&#230;?&#174;&lt;br /&gt;  MyCredentialCache = new System.Net.CredentialCache();&lt;br /&gt;  MyCredentialCache.Add( new System.Uri(strRootURI),&lt;br /&gt;   "NTLM",&lt;br /&gt;   new System.Net.NetworkCredential(strUserName, strPassword, strDomain)&lt;br /&gt;   );&lt;br /&gt;&lt;br /&gt;  // Create the HttpWebRequest object.&lt;br /&gt;  Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(strRootURI);&lt;br /&gt;&lt;br /&gt;  // &#230;&#338;&#8225;&#229;&#174;&#353;HttpWebRequest&#231;&#353;&#8222;&#232;&#186;&#171;&#228;&#187;&#189;&#229;&#8225;&#173;&#230;?&#174;&#239;&#188;&#338;&#230;&#173;&#164;&#229;&#164;&#8222;&#228;&#184;&#186;&#229;&#8230;&#179;&#233;&#8221;&#174;&#230;&#8240;&#8364;&#229;&#339;&#168;&#227;&#8364;&#8218;&#229;&#166;&#8218;&#230;&#382;&#339;&#228;&#189;&#191;&#231;&#8221;&#168;&#228;&#185;&#8249;&#229;&#8240;?&lt;br /&gt;  // &#229;&#710;&#8250;&#229;&#187;&#186;&#231;&#353;&#8222;MyCredentialCache&#239;&#188;&#338;&#229;&#710;&#8482;&#232;&#191;&#8482;&#228;&#184;&#170;&#232;&#186;&#171;&#228;&#187;&#189;&#229;&#8225;&#173;&#230;?&#174;&#230;&#732;&#175;&#229;?&#175;&#228;&#187;&#165;&#228;&#187;&#381;Web&#230;&#339;?&#229;&#352;&#161;&#229;&#8482;&#168;&#228;&#188;&#160;&#233;&#8364;&#8217;&lt;br /&gt;  // &#229;&#710;&#176;Exchange&#230;&#339;?&#229;&#352;&#161;&#229;&#8482;&#168;&#231;&#353;&#8222;&#239;&#188;&#338;&#228;&#189;&#8224;&#230;&#732;&#175;&#232;&#191;&#8482;&#230;&#160;&#183;&#229;&#184;&#166;&#230;?&#165;&#231;&#353;&#8222;&#233;&#8212;&#174;&#233;&#162;&#732;&#228;&#185;&#376;&#229;&#190;&#710;&#230;&#732;&#381;&#230;&#732;&#190;&#239;&#188;&#338;&#229;&#176;&#177;&#230;&#732;&#175;&#228;&#184;?&#232;&#402;&#189;&#229;&#164;&#376;&#232;&#8225;&#170;&lt;br /&gt;  // &#229;&#352;&#168;&#232;&#381;&#183;&#229;?&#8211;&#229;&#189;&#8220;&#229;&#8240;?&#231;&#8482;&#187;&#229;&#189;&#8226;&#229;&#710;&#176;&#229;&#376;&#376;&#231;&#353;&#8222;&#231;&#8221;&#168;&#230;&#710;&#183;&#231;&#353;&#8222;&#232;&#186;&#171;&#228;&#187;&#189;&#227;&#8364;&#8218;&#229;?&#179;&#228;&#190;&#191;&#229;&#183;&#178;&#231;&#187;?&#230;&#710;?&#229;&#352;&#376;&#231;&#8482;&#187;&#229;&#189;&#8226;&#229;&#710;&#176;&#229;&#376;&#376;&#239;&#188;&#338;&#233;&#8218;&#163;&#228;&#185;&#376;&#229;?&#170;&lt;br /&gt;  // &#232;&#402;&#189;&#233;&#8364;&#353;&#232;&#191;&#8225;form&#229;&#8224;?&#230;&#172;&#161;&#232;&#190;&#8220;&#229;&#8230;&#165;&#231;&#8221;&#168;&#230;&#710;&#183;&#229;??&#229;&#175;&#8224;&#231;&#160;?&#227;&#8364;&#8218;&#229;&#8250;&#160;&#230;&#173;&#164;&#239;&#188;&#338;&#230;&#710;&#8216;&#229;&#339;&#168;&#232;&#191;&#8482;&#233;&#8225;&#338;&#231;&#8221;&#168;&#231;&#353;&#8222;&#230;&#732;&#175;&lt;br /&gt;  // Request.Credentials = CredentialCache.DefaultCredentials&#239;&#188;&#338;&lt;br /&gt;  // &#232;&#191;&#8482;&#230;&#160;&#183;&#228;&#190;&#191;&#229;?&#175;&#228;&#187;&#165;&#232;&#381;&#183;&#229;&#190;&#8212;&#229;&#189;&#8220;&#229;&#8240;?&#231;&#8221;&#168;&#230;&#710;&#183;&#231;&#353;&#8222;&#229;&#8225;&#173;&#230;?&#174;&#239;&#188;&#338;&#228;&#189;&#8224;&#230;&#732;&#175;&#232;&#191;&#8482;&#230;&#160;&#183;&#229;&#184;&#166;&#230;?&#165;&#231;&#353;&#8222;&#233;&#8212;&#174;&#233;&#162;&#732;&#228;&#190;&#191;&#230;&#732;&#175;&#228;&#184;&#352;&#233;?&#162;&#230;??&#229;&#710;&#176;&#231;&#353;&#8222;&lt;br /&gt;  // &#232;&#186;&#171;&#228;&#187;&#189;&#229;&#8225;&#173;&#230;?&#174;&#230;&#8212;&#160;&#230;&#179;&#8226;&#228;&#188;&#160;&#233;&#8364;&#8217;&#231;&#353;&#8222;&#233;&#8212;&#174;&#233;&#162;&#732;&#239;&#188;&#338;&#232;&#167;&#163;&#229;&#8224;&#179;&#230;&#8211;&#185;&#230;&#179;&#8226;&#232;&#175;&#183;&#229;&#8230;&#179;&#230;&#179;&#168;&#228;&#184;&#8249;&#231;&#175;&#8225;&#230;&#8211;&#8225;&#231;&#171;&#160;&#227;&#8364;&#8218;&lt;br /&gt;  Request.Credentials = MyCredentialCache;&lt;br /&gt;&lt;br /&gt;  // &#230;&#338;&#8225;&#229;&#174;&#353;WebDAV&#231;&#353;&#8222;SEARCH&#230;&#8211;&#185;&#230;&#179;&#8226;&lt;br /&gt;  Request.Method = "SEARCH";&lt;br /&gt;&lt;br /&gt;  // Encode the body using UTF-8.&lt;br /&gt;  bytes = Encoding.UTF8.GetBytes((string)strQuery);&lt;br /&gt;&lt;br /&gt;  // Set the content header length. This must be&lt;br /&gt;  // done before writing data to the request stream.&lt;br /&gt;  Request.ContentLength = bytes.Length;&lt;br /&gt;&lt;br /&gt;  // Get a reference to the request stream.&lt;br /&gt;  RequestStream = Request.GetRequestStream();&lt;br /&gt;&lt;br /&gt;  // Write the SQL query to the request stream.&lt;br /&gt;  RequestStream.Write(bytes, 0, bytes.Length);&lt;br /&gt;&lt;br /&gt;  // Close the Stream object to release the connection&lt;br /&gt;  // for further use.&lt;br /&gt;  RequestStream.Close();&lt;br /&gt;&lt;br /&gt;  // Set the content type header.&lt;br /&gt;  Request.ContentType = "text/xml";&lt;br /&gt;&lt;br /&gt;  // Send the SEARCH method request and get the&lt;br /&gt;  // response from the server.&lt;br /&gt;  Response = (HttpWebResponse)Request.GetResponse();&lt;br /&gt;&lt;br /&gt;  // Get the XML response stream.&lt;br /&gt;  ResponseStream = Response.GetResponseStream();&lt;br /&gt;&lt;br /&gt;  // &#229;&#710;&#8250;&#229;&#187;&#186;XmlDocument&#229;&#175;&#185;&#232;&#177;&#161;&#239;&#188;&#338;&#229;&#185;&#182;&#232;&#381;&#183;&#229;?&#8211;&#230;&#8221;&#182;&#228;&#187;&#182;&#231;&#174;&#177;&#231;&#353;&#8222;unreadcount&#232;&#352;&#8218;&#231;&#8218;&#185;&#231;&#353;&#8222;&#229;&#8364;&#188;&lt;br /&gt;  ResponseXmlDoc = new XmlDocument();&lt;br /&gt;  ResponseXmlDoc.Load(ResponseStream);&lt;br /&gt;  HrefNodes = ResponseXmlDoc.GetElementsByTagName("a:displayname");&lt;br /&gt;  SizeNodes = ResponseXmlDoc.GetElementsByTagName("d:unreadcount");&lt;br /&gt;  for(int i=0;i&lt;HrefNodes.Count;i++)&lt;br /&gt;  {&lt;br /&gt;   if(HrefNodes[i].InnerText=="&#230;&#8221;&#182;&#228;&#187;&#182;&#231;&#174;&#177;")&lt;br /&gt;    count=int.Parse(SizeNodes[i].InnerText);&lt;br /&gt;  }&lt;br /&gt;  ResponseStream.Close();&lt;br /&gt;  Response.Close();&lt;br /&gt;}&lt;br /&gt;catch(Exception)&lt;br /&gt;{&lt;br /&gt;  // Catch any exceptions. Any error codes from the SEARCH&lt;br /&gt;  // method request on the server will be caught here, also.&lt;br /&gt;  return -1;&lt;br /&gt;}&lt;br /&gt;return count;&lt;br /&gt;} &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 15 Oct 2006 07:10:59 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2820</guid>
      <author>mornlee (mornlee)</author>
    </item>
    <item>
      <title>javasrcritpt email to avoid spam</title>
      <link>http://snippets.dzone.com/posts/show/2720</link>
      <description>// email is written with javascript to hide it aganst scanning.&lt;br /&gt;// if javascript is off, the email is obfuscated&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;script type="text/javascript" language=javascript&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;name=('hugo');&lt;br /&gt;at=('@');&lt;br /&gt;domain=('mueller');&lt;br /&gt;dot=('.');&lt;br /&gt;ext=('de');&lt;br /&gt;document.write('&lt;a href="mailto:' + name + at + domain + dot + ext + '"&gt;' + name + at + domain + dot + ext + '&lt;\/a&gt;');&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;noscript&gt;hugo (at) mueller (dot) de&lt;/noscript&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 27 Sep 2006 03:57:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2720</guid>
      <author>ovhaag (Oliver Haag)</author>
    </item>
    <item>
      <title>Simple "Send Email from Ruby" Method</title>
      <link>http://snippets.dzone.com/posts/show/2362</link>
      <description>By Ian Purton and found at &lt;a href="http://jiploo.com/blog/simple-email-send-function-in-ruby/"&gt;http://jiploo.com/blog/simple-email-send-function-in-ruby/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def send_email(from, from_alias, to, to_alias, subject, message)&lt;br /&gt;	msg = &lt;&lt;END_OF_MESSAGE&lt;br /&gt;From: #{from_alias} &lt;#{from}&gt;&lt;br /&gt;To: #{to_alias} &lt;#{to}&gt;&lt;br /&gt;Subject: #{subject}&lt;br /&gt;	&lt;br /&gt;#{message}&lt;br /&gt;END_OF_MESSAGE&lt;br /&gt;	&lt;br /&gt;	Net::SMTP.start('localhost') do |smtp|&lt;br /&gt;		smtp.send_message msg, from, to&lt;br /&gt;	end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 04 Aug 2006 03:14:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2362</guid>
      <author>peter (Peter Cooperx)</author>
    </item>
    <item>
      <title>ezmlm command line reference</title>
      <link>http://snippets.dzone.com/posts/show/2177</link>
      <description>List all email addresses in list&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ezmlm-list /path/to/mldir&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Add an email address to the list&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ezmlm-sub /path/to/mldir foo@bar.com&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Remove an email address from the list&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ezmlm-unsub /path/to/mldir foo@bar.com&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Tue, 13 Jun 2006 01:59:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2177</guid>
      <author>zdw (Zack Williams)</author>
    </item>
    <item>
      <title>Sending html mail with embedded image</title>
      <link>http://snippets.dzone.com/posts/show/1678</link>
      <description>See detail in &lt;a href=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810&gt;this recipe&lt;/a&gt;.&lt;br /&gt;The code below show the key parts of embedding an image.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# require the new email package&lt;br /&gt;from email.MIMEMultipart import MIMEMultipart&lt;br /&gt;from email.MIMEText import MIMEText&lt;br /&gt;from email.MIMEImage import MIMEImage&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;...&lt;br /&gt;msgRoot = MIMEMultipart('related')&lt;br /&gt;...&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;# Assumes the image is in current directory&lt;br /&gt;fp = open('test.jpg', 'rb')&lt;br /&gt;msgImage = MIMEImage(fp.read())&lt;br /&gt;fp.close()&lt;br /&gt;&lt;br /&gt;# Define the image's ID as referenced above&lt;br /&gt;msgImage.add_header('Content-ID', '&lt;image1&gt;')&lt;br /&gt;msgRoot.attach(msgImage)&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;smtp.sendmail(strFrom, strTo, msgRoot.as_string())&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 10 Mar 2006 10:12:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1678</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
  </channel>
</rss>
