+
+ # Logging
+ my $cust_msg = $options{'cust_msg'};
+ if ( $cust_msg ) {
+ $cust_msg->env_from($options{from});
+ $cust_msg->env_to(join(",", @to));
+ $cust_msg->header($message->header_as_string);
+ $cust_msg->body($message->body_as_string);
+ $cust_msg->_date($time);
+ $cust_msg->error($error);
+ $cust_msg->status( $error ? 'failed' : 'sent' );
+ $cust_msg->replace;
+ };
+ return $error;
+