Support

Account

Home Forums Front-end Issues Why my email is not sent?

Solving

Why my email is not sent?

  • Hello,
    I’m using ACF form in the front, entry is saved but email is not sent !

    
    add_action('acf/save_post', 'my_save_post');
    
    function my_save_post( $post_id ) {
    	
    	// bail early if not a reservation post        
            if( get_post_type($post_id) !== 'reservation' ) {		
    		return;
    	}
    	
    	// bail early if editing in admin
            /*	
            if( is_admin() ) {
    		return;
    	}*/
    	
    	
    	// vars
    	$post = get_post( $post_id );
    	
    	
    	// get custom fields (field group exists for content_form)
    	$name = get_field('societe_adherente', $post_id);
    	$email = get_field('email_de_contact', $post_id);
    	
    	
    	// email data
    	$to = 'contact@gmail.com';
    	$headers = 'From: ' . $name . ' <' . $email . '>' . "\r\n";
    	$subject = $post->post_title;
    	$body = 'TEST'; //$post->post_content;
    	
    	
    	// send email
    	wp_mail($to, $subject, $body, $headers );
    	
    }
    

    Strange, I have installed Email log plugin wich display that emails are sent but i never receive them !

    http://imgur.com/JZeF2wr

    Thank you for your help

  • Hello,

    If the email set in email field :
    $email = get_field('email_de_contact', $post_id);
    is of type : @gmail.com, @yahoo.fr …
    The email is not received
    if the email is of type @customaddress.com the email is received !

    Strange, i’m not sending email to email_de_contact !

    Thank you

  • The email is probably being stopped or blocked as spam by the receiver and not something in ACF or you site.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.