diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index e004e13e21ed7b4e57a9eb87baea44403cfbd4bd..adaf7713f57d68ba889f3c01daaa2bdab40177b7 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -2099,9 +2099,13 @@ static void sendmail_thread(void* arg)
 				memset(&server_addr,0,sizeof(server_addr));
 				server_addr.sin_addr.s_addr = ip_addr;
 				server_addr.sin_family = AF_INET;
-				server_addr.sin_port   = htons(IPPORT_SMTP);
+				if(startup->options&MAIL_OPT_RELAY_TX)
+					server_addr.sin_port = htons(startup->relay_port);
+				else
+					server_addr.sin_port = htons(IPPORT_SMTP);
 				
-				lprintf("SendMail: connecting to %s [%s]"
+				lprintf("SendMail: connecting to port %u on %s [%s]"
+					,ntohs(server_addr.sin_port)
 					,server,inet_ntoa(server_addr.sin_addr));
 				if((i=connect(sock, (struct sockaddr *)&server_addr, sizeof(server_addr)))!=0) {
 					lprintf("!SendMail: ERROR %d (%d) connecting to SMTP server: %s"
@@ -2301,6 +2305,9 @@ void mail_server(void* arg)
 		return;
 	}
 
+	if(startup->relay_port==0)
+		startup->relay_port=IPPORT_SMTP;
+
 	thread_up();
 
 	status("Initializing");
@@ -2438,13 +2445,13 @@ void mail_server(void* arg)
     	,sizeof (server_addr));
 
 	if (result != 0) {
-		lprintf("!ERROR %d (%d) binding SMTP socket to port %d"
+		lprintf("!ERROR %d (%d) binding SMTP socket to port %u"
 			,result, ERROR_VALUE, startup->smtp_port);
 		cleanup(1);
 		return;
 	}
 
-    lprintf("SMTP socket bound to port %d",startup->smtp_port);
+    lprintf("SMTP socket bound to port %u",startup->smtp_port);
 
     result = listen (server_socket, 1);
 
diff --git a/src/sbbs3/mailsrvr.h b/src/sbbs3/mailsrvr.h
index f9674d9937adeeae700443972f23a985c9a524ac..7fd0384439cd7b48101c877ce540b35c311a3b0d 100644
--- a/src/sbbs3/mailsrvr.h
+++ b/src/sbbs3/mailsrvr.h
@@ -46,7 +46,7 @@ typedef struct {
 	WORD	max_inactivity;
 	WORD	max_delivery_attempts;
 	WORD	rescan_frequency;	/* In seconds */
-	WORD	reserved_word3;
+	WORD	relay_port;
 	WORD	reserved_word2;
 	WORD	reserved_word1;
     DWORD   interface_addr;