Support

Account

Home Forums ACF PRO Check if email address is set and send email issue

Solved

Check if email address is set and send email issue

  • I’m trying to check if my email field has a value and if it does, send the email. My code is below.

    I don’t get any errors but I don’t get any email either, what am I missing?

    <?php
    	// Email the form
    	
    	
    		function send_email( $pov_id ) {
    		if (get_field('email', $pov_id)) {
    			$post_url = get_permalink( $post_id );
    			$subject = "POV Travel Calculator Summary";
    			/* Let's prepare the message for the e-mail */
    			$message = "Hello!
    
    			Total Travel Entitlement: $".$totalTvl."
    			
    			<a href='. $post_url. '>Click here to view your travel entitlement summary</a>\n\n
    			";
    			
    			//sends email
    			wp_mail($email, $subject, $message );
    			}
    		}
    ?>
  • Disregard,

    I removed function send_email( $pov_id ) {} and it works fine.

    This is the value in walking away from the code and coming back later.

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

You must be logged in to reply to this topic.