diff --git a/lib/modules/Protocols.pmod/SMTP.pmod b/lib/modules/Protocols.pmod/SMTP.pmod
index 91f5129e551947c184a60acc30d70cdb6eb20b77..c2324b7aa4537ee4713c30f46748710629c0bbde 100644
--- a/lib/modules/Protocols.pmod/SMTP.pmod
+++ b/lib/modules/Protocols.pmod/SMTP.pmod
@@ -76,17 +76,31 @@ class client
   
   void send_message(string from, string *to, string body)
   {
-    cmd("MAIL FROM: "+from);
-    foreach(to, string t)
-      cmd("RCPT TO: "+t);
+    cmd("MAIL FROM: <" + from + ">");
+    foreach(to, string t) {
+      cmd("RCPT TO: <" + t + ">");
+    }
     cmd("DATA");
     cmd(body+"\r\n.");
     cmd("QUIT");
   }
 
+  static string parse_addr(string addr)
+  {
+    array(string|int) tokens = replace(MIME.tokenize(to), '@', "@");
+
+    int i;
+    tokens = tokens[search(tokens, '<') + 1..];
+
+    if ((i = search(tokens, '>')) != -1) {
+      tokens = tokens[..i-1];
+    }
+    return tokens*"";
+  }
+
   void simple_mail(string to, string subject, string from, string msg)
   {
-    send_message(from, ({ to }),
+    send_message(parse_addr(from), ({ parse_addr(to) }),
 		 (string)MIME.Message(msg, (["mime-version":"1.0",
 					     "subject":subject,
 					     "from":from,