--- parser3/src/classes/mail.C 2002/12/05 09:41:56 1.83 +++ parser3/src/classes/mail.C 2002/12/19 08:34:32 1.85 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_MAIL_C="$Date: 2002/12/05 09:41:56 $"; +static const char* IDENT_MAIL_C="$Date: 2002/12/19 08:34:32 $"; #include "pa_config_includes.h" @@ -96,13 +96,14 @@ static const String& attach_hash_to_stri struct Mail_info { Charset *charset; const char *content_charset_name; String *header; - const String **from, **to; + const String **from; + String **to; const String *errors_to; bool mime_version_specified; }; #endif -const String& extractEmail(const String& string); +String& extractEmails(const String& string); static void add_header_attribute(const Hash::Key& raw_element_name, Hash::Val *aelement_value, void *info) { Value& element_value=*static_cast(aelement_value); @@ -116,11 +117,11 @@ static void add_header_attribute(const H // fetch from & to from header for SMTP if(mi.from && low_element_name=="from") - *mi.from=&extractEmail(element_value.as_string()); + *mi.from=&extractEmails(element_value.as_string()); if(mi.to && low_element_name=="to") - *mi.to=&extractEmail(element_value.as_string()); + *mi.to=&extractEmails(element_value.as_string()); if(low_element_name=="errors-to") - mi.errors_to=&extractEmail(element_value.as_string()); + mi.errors_to=&extractEmails(element_value.as_string()); if(low_element_name=="mime-version") mi.mime_version_specified=true; @@ -171,7 +172,7 @@ static int sort_cmp_string_double_value( } static const String& message_hash_to_string(Request& r, const String& method_name, Hash& message_hash, int level, - const String **from, const String **to) { + const String **from, String **to) { Pool& pool=r.pool(); // prepare header: 'hash' without "body" @@ -280,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; @@ -402,10 +404,18 @@ static void _send(Request& r, const Stri &method_name, "message must be hash"); - const String *from, *to; + const String *from=0; + String *to=0; + String **to_param= +#ifdef _MSC_VER + &to +#else + 0 +#endif + ; const String& message=hash->get(*body_name)/*old format*/? - message_hash_to_string(r, method_name, *hash, 0, &from, &to) : // old - static_cast(r.get_self())->message_hash_to_string(r, &method_name, hash, 0, &from, &to); // new + message_hash_to_string(r, method_name, *hash, 0, &from, to_param) : // old + static_cast(r.get_self())->message_hash_to_string(r, &method_name, hash, 0, &from, to_param); // new //r.write_pass_lang(message); sendmail(r, method_name, message, from, to);