From d34b6bab43c369139bbfc370b5c2d2848548a9da Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 27 Oct 2005 20:45:12 +0000 Subject: [PATCH] * Allow 'host:port' syntax when specifying an outbound SMTP smart-host --- citadel/ChangeLog | 3 +++ citadel/docs/citadel.html | 4 +++- citadel/serv_smtp.c | 13 ++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 475e541b7..e885b5d52 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,5 +1,8 @@ $Id$ +Thu Oct 27 16:44:36 EDT 2005 ajc +* Allow "host:port" syntax when specifying an outbound SMTP smart-host + Wed Oct 26 13:22:02 EDT 2005 ajc * msgbase.c: Yet Another Fix to the handling of embedded message/rfc822 diff --git a/citadel/docs/citadel.html b/citadel/docs/citadel.html index 08b54b77a..c406d8baf 100644 --- a/citadel/docs/citadel.html +++ b/citadel/docs/citadel.html @@ -1874,7 +1874,9 @@ sites; you may require (due to local convention, security policy, or whatever) that all outbound mail be sent to an SMTP relay or forwarder. To configure this functionality, simply enter the domain name or IP address of your relay -as a 'smart-host' entry.

+as a 'smart-host' entry. If your relay server is running on a port other +than the standard SMTP port 25, you can also specify the port number +using "host:port" syntax; i.e. relay99.myisp.com:2525

directory: a domain for which you are participating in directory services across any number of Citadel nodes. For example, if users who have addresses in the domain citadel.org are spread diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index fcfd49fa1..d460ba611 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -921,9 +921,11 @@ void smtp_try(const char *key, const char *addr, int *status, int num_mxhosts; int mx; int i; - char user[SIZ], node[SIZ], name[SIZ]; + char user[1024], node[1024], name[1024]; char buf[1024]; char mailfrom[1024]; + char mx_host[256]; + char mx_port[256]; int lp, rp; char *msgtext; char *ptr; @@ -1006,8 +1008,13 @@ void smtp_try(const char *key, const char *addr, int *status, sock = (-1); for (mx=0; (mx\n", buf); - sock = sock_connect(buf, "25", "tcp"); + extract_token(mx_host, buf, 0, ':', sizeof mx_host); + extract_token(mx_port, buf, 1, ':', sizeof mx_port); + if (!mx_port[0]) { + strcpy(mx_port, "25"); + } + lprintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port); + sock = sock_connect(mx_host, mx_port, "tcp"); snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno)); if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n"); if (sock < 0) snprintf(dsn, SIZ, "%s", strerror(errno)); -- 2.39.2