"; if (is_email($email_from) && is_email($email_to)) { $message = "Name: $fullname\n"; $message .= "Email: $email\n"; $message .= "Phone: $phone\n"; $message .= "Contact Preference: "; if ($cp == 'email') $message .= "Email\n"; elseif ($cp == 'phone') $message .= "Phone\n"; else $message .= "No Preference\n"; $message .= "Institution: $institution\n"; $message .= "Comments: $comments\n"; $message .= "Upload: " . (isset($compare_holdings_file) ? 'see attachment' : '[no upload]') . "\n"; // setup some custom mail settings since we need to specify a different attachment name global $phpmailer; // (Re)create it, if it's gone missing if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(); } $phpmailer->IsHTML(false); $phpmailer->IsMail(); $phpmailer->From = $email_from; $phpmailer->FromName = 'Portico'; $phpmailer->AddAddress($email_to, 'Portico'); $phpmailer->Subject = $email_subject; $phpmailer->Body = $message; if (isset($compare_holdings_file)) { $phpmailer->AddAttachment($compare_holdings_file['path'], $compare_holdings_file['name']); } // if (wp_mail($email_to, $email_subject, $message, $message_headers)) { if($phpmailer->Send()) { // cleanup and remove the file $file_path = $compare_holdings_file['path']; if (file_exists($file_path)) unlink($file_path); unset($_SESSION['compare_holdings_file']); wp_redirect('?s'); exit; } else { $errors['mail'] = __('There was a technical problem while trying to send your report. Please try again or contact us by email or phone. We apologize for the inconvenience.'); } } else { $errors['form'] = 'There is a configuration error in the form. Please contact us by email or phone. We apologize for the inconvenience.'; } } else { // echo "do stuff for an error"; } } elseif ($_SERVER['QUERY_STRING'] == 's') { $success_message = true; } else { unset($_SESSION['compare_holdings_file']); } ?>

0): ?>

Error:

* Required fields

>
>
>
/>
/>
/>

' . $compare_holdings_file['name'] . " is ready to be sent. If you want to replace this file just upload a new one.

"; } ?>
(please email files greater than 3MB
directly to info@portico.org)