-/* @(#) $Id: sendmail.c,v 1.30 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id: ./src/os_maild/sendmail.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
/* Connecting to the smtp server */
- socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver);
+ socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver, 0);
if(socket < 0)
{
return(socket);
if(msg)
free(msg);
close(socket);
- return(OS_INVALID);
+ return(OS_INVALID);
}
}
else
/* Additional RCPT to */
final_to[0] = '\0';
final_to_sz = sizeof(final_to) -2;
-
+
if(mail->gran_to)
{
i = 0;
snprintf(snd_msg,127, TO, mail->gran_to[i]);
strncat(final_to, snd_msg, final_to_sz);
final_to_sz -= strlen(snd_msg) +2;
-
+
i++;
continue;
}
/* Sending date */
memset(snd_msg,'\0',128);
-
+
/* Solaris doesn't have the "%z", so we set the timezone to 0. */
#ifdef SOLARIS
#else
strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
#endif
-
+
OS_SendTCP(socket,snd_msg);
MailNode *mailmsg;
additional_to[0] = '\0';
-
+
/* If there is no sms message, we attempt to get from the
* email list.
*/
{
merror("%s: No email to be sent. Inconsistent state.",ARGV0);
}
-
+
/* Connecting to the smtp server */
- socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver);
+ socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver, 0);
if(socket < 0)
{
return(socket);
if(msg)
free(msg);
close(socket);
- return(OS_INVALID);
+ return(OS_INVALID);
}
}
else
free(msg);
i++;
- continue;
+ continue;
}
-
+
MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", snd_msg, msg);
free(msg);
i++;
{
break;
}
-
+
memset(snd_msg,'\0',128);
snprintf(snd_msg,127, TO, mail->to[i]);
OS_SendTCP(socket,snd_msg);
#else
strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
#endif
-
+
OS_SendTCP(socket,snd_msg);