--- parser3/src/classes/mail.C 2002/12/05 15:00:00 1.84 +++ parser3/src/classes/mail.C 2002/12/26 14:01:46 1.87 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_MAIL_C="$Date: 2002/12/05 15:00:00 $"; +static const char* IDENT_MAIL_C="$Date: 2002/12/26 14:01:46 $"; #include "pa_config_includes.h" @@ -281,15 +281,16 @@ static void sendmail(Request& r, const S Hash *mail_conf=static_cast(r.classes_conf.get(mail_base_class->name())); const char *exception_type="email.format"; - if(!from) + if(!from) // we use in sendmail -f {from} && SMTP MAIL from: {from} throw Exception(exception_type, &method_name, "parameter does not specify 'from' header field"); - if(!to) + +#ifdef _MSC_VER + if(!to) // we use only in SMTP RCPT to: {to} throw Exception(exception_type, &method_name, "parameter does not specify 'to' header field"); -#ifdef _MSC_VER SMTP& smtp=*new(pool) SMTP(pool, method_name); Value *server_port; @@ -313,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 @@ -325,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"); @@ -403,10 +411,10 @@ static void _send(Request& r, const Stri &method_name, "message must be hash"); - const String *from; - String *to; + const String *from=0; + String *to=0; String **to_param= -#ifdef WIN32 +#ifdef _MSC_VER &to #else 0