Changeset 216


Ignore:
Timestamp:
Feb 18, 2009, 7:30:38 PM (16 years ago)
Author:
katerina
Message:

Fix ticket #138 (ability to specify SMTP port). Patch by lucas sizzo org.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/sh_mail.h

    r214 r216  
    5454int sh_mail_pushstack (int severity, const char * msg, const char * alias);
    5555
     56/* Set the port to use (default 25)
     57 */
     58int sh_mail_set_port (const char * str);
     59
    5660/* set sender of mail
    5761 */
    5862int sh_mail_set_sender (const char *str);
    5963
    60 int sh_mail_add_or  (const char * str);
    61 int sh_mail_add_and (const char * str);
    62 int sh_mail_add_not (const char * str);
    63 
    6464#endif
  • trunk/src/sh_mail.c

    r215 r216  
    916916}
    917917
     918static int sh_mail_port = IPPORT_SMTP;
     919
     920int sh_mail_set_port (const char * str)
     921{
     922  int i = atoi (str);
     923 
     924  SL_ENTER(_("sh_mail_set_port"));
     925 
     926  if (i >= 0 && i < 65535)
     927    {
     928      sh_mail_port = i;
     929    }
     930  else
     931    {
     932      sh_mail_port = IPPORT_SMTP;
     933      SL_RETURN ((-1), _("sh_mail_set_port"));
     934    }
     935 
     936  SL_RETURN( (0), _("sh_mail_set_port"));
     937}
    918938
    919939/*************************
     
    10171037      TPT((0, FIL__, __LINE__, _("msg=<user %s machine %s>\n"),
    10181038           ma_user, ma_machine));
    1019       fd = connect_port (ma_machine, IPPORT_SMTP,
     1039      fd = connect_port (ma_machine, sh_mail_port,
    10201040                         error_call, &error_num, error_msg, 256);
    10211041    }
     
    10401060                   _("msg=<user %s mx %s pref %d>\n"),
    10411061                   ma_user, ma_machine, result[i].pref));
    1042               fd = connect_port (ma_machine, IPPORT_SMTP,
     1062              fd = connect_port (ma_machine, sh_mail_port,
    10431063                                 error_call, &error_num, error_msg, 256);
    10441064              if (fd >= 0)
  • trunk/src/sh_readconf.c

    r215 r216  
    11011101  { N_("setmailrelay"),      SH_SECTION_MAIL,  SH_SECTION_MISC,
    11021102    sh_mail_set_relay },
     1103  { N_("setmailport"),       SH_SECTION_MAIL,  SH_SECTION_MISC,
     1104    sh_mail_set_port },
    11031105  { N_("mailsingle"),        SH_SECTION_MAIL,  SH_SECTION_MISC,
    11041106    sh_mail_setFlag },
Note: See TracChangeset for help on using the changeset viewer.