* Allow 'host:port' syntax when specifying an outbound SMTP smart-host
authorArt Cancro <ajc@citadel.org>
Thu, 27 Oct 2005 20:45:12 +0000 (20:45 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 27 Oct 2005 20:45:12 +0000 (20:45 +0000)
citadel/ChangeLog
citadel/docs/citadel.html
citadel/serv_smtp.c

index 475e541b7cfe0985d7e34383a38e6c30397defb4..e885b5d52dfbeb2efc795525c45bcfda67540409 100644 (file)
@@ -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
 
index 08b54b77a9c8f1986a5b41a6b91853fcaa8b73c4..c406d8bafdf95fb226c8053b9fec1968e81de795 100644 (file)
@@ -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.</p>
+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 &quot;host:port&quot; syntax; i.e. <tt>relay99.myisp.com:2525</tt></p>
 <p><b>directory:</b> 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 <tt>citadel.org</tt> are spread
index fcfd49fa16f03433574802ee23d670575221d100..d460ba611e90729131a253bceca90ea9c7b7c7a4 100644 (file)
@@ -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<num_mxhosts && sock < 0); ++mx) {
                extract_token(buf, mxhosts, mx, '|', sizeof buf);
-               lprintf(CTDL_DEBUG, "Trying <%s>\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));