--- parser3/src/classes/mail.C 2002/12/19 08:34:32 1.85 +++ parser3/src/classes/mail.C 2003/03/17 14:48:04 1.88.4.1 @@ -1,11 +1,11 @@ /** @file Parser: @b mail parser class. - Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_MAIL_C="$Date: 2002/12/19 08:34:32 $"; +static const char* IDENT_MAIL_C="$Date: 2003/03/17 14:48:04 $"; #include "pa_config_includes.h" @@ -219,7 +219,7 @@ static const String& message_hash_to_str // header char *boundary=0; if(multipart) { - boundary=(char *)pool.malloc(MAX_NUMBER); + boundary=(char *)pool.malloc_atomic(MAX_NUMBER); snprintf(boundary, MAX_NUMBER-5/*lEvEl*/, "lEvEl%d", level); // multi-part result << "content-type: multipart/mixed; boundary=\"" << boundary << "\"\n"; @@ -314,11 +314,14 @@ static void sendmail(Request& r, const S // $MAIN:MAIL.sendmail["/usr/lib/sendmail -t -i -f postmaster"] default const String *sendmail_command; -#ifdef PA_FORCED_SENDMAIL - sendmail_command=new(pool) String(pool, PA_FORCED_SENDMAIL); -#else const char *sendmailkey_cstr="sendmail"; if(mail_conf) { +#ifdef PA_FORCED_SENDMAIL + throw Exception("parser.runtime", + &method_name, + "Parser was configured with --with-sendmail="PA_FORCED_SENDMAIL + " key, to change sendmail you should reconfigure and recompie it"); +#else if(Value *sendmail_value=static_cast(mail_conf->get(String(pool, sendmailkey_cstr)))) sendmail_command=&sendmail_value->as_string(); else @@ -326,14 +329,18 @@ static void sendmail(Request& r, const S &method_name, "$"MAIN_CLASS_NAME":"MAIL_NAME".%s not defined", sendmailkey_cstr); +#endif } else { +#ifdef PA_FORCED_SENDMAIL + sendmail_command=new(pool) String(pool, PA_FORCED_SENDMAIL); +#else String *test=new(pool) String(pool, "/usr/sbin/sendmail"); if(!file_executable(*test)) test=new(pool) String(pool, "/usr/lib/sendmail"); test->APPEND_CONST(" -t -i -f postmaster"); sendmail_command=test; - } #endif + } // we know sendmail_command here, should replace "postmaster" with "$from" from message int at_postmaster=sendmail_command->pos("postmaster");