From 72343a79a97ef2bc0357c5fad8fa5980fa308326 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Thu, 16 Feb 2023 22:12:27 -0800
Subject: [PATCH] Moved sendmail.js rcpt() to parse_mail_recipient() here for
 reuse

---
 exec/load/mailutil.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/exec/load/mailutil.js b/exec/load/mailutil.js
index 774f36fb5a..07b3dd4db5 100644
--- a/exec/load/mailutil.js
+++ b/exec/load/mailutil.js
@@ -3,8 +3,6 @@
 // Parses Internet mail and USENET article header fields 
 // for use with newsutil.js and mailproc_util.js
 
-// $Id: mailutil.js,v 1.3 2016/08/12 22:15:02 rswindell Exp $
-
 //Michael J. Ryan - 2004-04-16 - tracker1(at)theroughnecks.net
 // gets the name portion for the "to/from"
 function mail_get_name(strIn) {
@@ -29,6 +27,17 @@ function mail_get_address(strIn) {
 	return null;
 }
 
+function parse_mail_recipient(str)
+{
+	var hdr = {
+		to: mail_get_name(str),
+		to_net_addr: mail_get_address(str)
+	};
+	if(netaddr_type(str) == NET_NONE)
+		hdr.to_ext = 1; // TODO: look up alias?
+	return hdr;
+}
+
 function fidoaddr_to_emailaddr(name, addr, tld)
 {
 	var ftn;
-- 
GitLab