From 4f6351140adc13c26b58692bd32fcbcfae74fd2d Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Tue, 26 Jan 2021 00:40:35 -0800
Subject: [PATCH] Add more detail to the message body and support no-emailaddr
 change

Add the name of the BBS and the IP address, protocol, and port of the
requesting user/client.

If prompt=false in the modopts.ini, don't prompt for (allow change of)
destination email address. Extra security-conscious systems may actually
verify email addresses and want to disallow sending of files to other
(non-verified) addresses.
---
 exec/emailfiles.js | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/exec/emailfiles.js b/exec/emailfiles.js
index 5eaf1f435a..d7d2702fb3 100755
--- a/exec/emailfiles.js
+++ b/exec/emailfiles.js
@@ -148,9 +148,10 @@ function sendfiles()
 			, netattr: MSG_KILLSENT
 			, auxattr: MSG_FILEATTACH
 		};
-		if(!msgbase.save_msg(hdr,
-			format(options.msgbody || "Your requested file (%u of %u) is attached."
-				,i + 1, list.length))) {
+		var msgbody = format(options.msgbody || "Your requested file (%u of %u) is attached." +
+			"\r\n\r\nRequested from %s by %s via %s port %u."
+			,i + 1, list.length, system.name, client.ip_address, client.protocol, client.port);
+		if(!msgbase.save_msg(hdr, msgbody)) {
 			alert("Error " + msgbase.error + " saving msg");
 			continue;
 		}
@@ -171,10 +172,14 @@ if(!user.is_sysop && !(msg_area.inet_netmail_settings & NMAIL_ALLOW))
 else if(!user.is_sysop && !(msg_area.inet_netmail_settings & NMAIL_FILE))
 	alert(bbs.text(EmailFilesNotAllowed));
 else {
-	console.print(options.prompt || "\x01h\x01yE-mail address: ");
-	if(!bbs.mods.emailfiles_address)
-		bbs.mods.emailfiles_address = user.netmail;
-	var address = console.getstr(bbs.mods.emailfiles_address, 60, K_EDIT | K_AUTODEL | K_LINE);
+	if(options.prompt === false)
+		address = user.netmail;
+	else {
+		console.print(options.prompt || "\x01h\x01yE-mail address: ");
+		if(!bbs.mods.emailfiles_address)
+			bbs.mods.emailfiles_address = user.netmail;
+		var address = console.getstr(bbs.mods.emailfiles_address, 60, K_EDIT | K_AUTODEL | K_LINE);
+	}
 	if(console.aborted || netaddr_type(address) != NET_INTERNET || address.indexOf('@' + system.inet_addr) >= 0)
 		alert(options.badaddr || "Unsupported e-mail address");
 	else {
-- 
GitLab