I’ve installed a theme called PerfectCV. There’s contact form in theme functions that I can’t get working. In theme options I’ve added my email address but emails sent form the contact form seem not to be coming through.
I am new to programming but found the following in theme functions.php which deals with the contact form:
add_action('wp_ajax_mail_action', 'pcv_sent_email');
add_action('wp_ajax_nopriv_mail_action', 'pcv_sent_email');
function pcv_sent_email(){
$pcv_name = $_POST['name'];
$pcv_email = $_POST['email'];
$pcv_message = $_POST['message'];
$pcv_to = $_POST['recipient_mail'];
$pcv_subject = __( 'Sent by CV Contact Form', 'perfectcv' );
$pcv_headers[] = __( 'From: ', 'perfectcv' ) . $pcv_name .' <'. $pcv_email .'>';
add_filter( 'wp_mail_content_type', create_function( '', 'return "text/html";' ) );
if( wp_mail( $pcv_to, $pcv_subject, $pcv_message, $pcv_headers ) ) {
echo __( 'Message sent!', 'perfectcv' );
} else {
echo __( 'Message NOT sent!', 'perfectcv' );
}
die();
}
Any ideas?
WP-Mail-SMTP plugin solved my problem. Thanks to everyone!
That particular template uses the php mail() function and the default email address you have set in WordPress settings->email. There are no other configurations.
Make sure the email address that’s there actually exists and is configured on your server. You can check this in your site’s cpanel.
If the address does not exist, or it’s not the one you want to use, you can change it in the settings panel. Again, make sure the address exists in your cpanel or add it if it does not.