Code Error
-
Hi,
I have raised this before with you by email but nothing has been done. I believe there is an issue with the code of this plugin which creates php errors when emails do not send due to a server problem.
The code below comes at the end of transmail.php. First it tries to get the variable $details from $responseData. However if there is no server connection then $responseData is not present so it throws up an error. Secondly it seems you are using $message for two different items. The first is the error message and the second is the email message as part of $mail_data.
Please do not ask me to email your team with this as I have done it before and nothing was done.
if($http_code == '200' || $http_code == '201') { return true; } $details = $responseData->error->details; $message = $details[0]->message; $mail_data = array( 'to' => $to, 'subject' => $subject, 'message' => $message, 'headers' => $headers1, 'attachments' => $attachments ); do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $message, $mail_data ) ); return false;
My current workaround to avoid php errors and be able to correctly log when emails are not sent in my mail logger is this.
if($http_code == '200' || $http_code == '201') { return true; } /* $details = $responseData->error->details; $message = $details[0]->message; */ $mail_data = array( 'to' => $to, 'subject' => $subject, 'message' => $message, 'headers' => $headers1, 'attachments' => $attachments ); do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', 'No Response from Server', $mail_data ) ); return false;
If I am wrong about this then please accept my apologies.
Many thanks
- The topic ‘Code Error’ is closed to new replies.