Here is a function I made that sends an email with verification code to user email. I am calling this function once someone submits the registration form.
function send_verification_email($email, $code) { $subject = 'Verify Your Email'; $body = $code; $headers = array('Content-Type: text/html; charset=UTF-8'); $headers[] = 'From: Example <no-reply@example.com>'; wp_mail( $email, $subject, $body, $headers );}
If I use these codes in the actual page template, it works properly. Just not in functions.php
. I've checked if $email, $code
parameters are being passed properly, it is.
I've checked postfix
log, there was no email even created in postfix. So basically wp_mail()
is fully dormant in functions.php
. Did anyone faced this problem before? Is there any way I can make this work in functions.php
file?
Thanks in advance