0
$email = 'test@xyz.com';
$subject = 'Taxi Booking Response';
$headers = 'From: test@taxieu.cz;'."\r\n";
$headers .= 'Content-Type: text/html; charset=UTF-8';
$body = 'dobrý ten, zkušební odeslání kontaktního formuláře';
wp_mail( $email, $subject, $body, $headers );

I've used this code to send email but not working sending the email though it return a true value.But when I am using

$email = 'test@xyz.com';
$subject = 'Taxi Booking Response';
$headers = array('Content-Type: text/html; charset=UTF-8');
$body = 'dobrý ten, zkušební odeslání kontaktního formuláře';
wp_mail( $email, $subject, $body, $headers );

Then it working fine in Namecheap hosting's website but not in other hosting's website. I would appriciate if anyone help me with a solution.

Regards

  • Sounds like a hosting problem. Is PHP mail blocked by host? – Howard E Feb 11 '20 at 12:54
  • `$subject = 'Taxieu - kalkulace ceny ze dne '.date("d-m-Y H:i"); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: Taxieu ' . "\r\n"; $headers .= 'Reply-To: taxi@taxieu.cz' . "\r\n"; $headers .= 'BCc: Xjabla '; $body = 'dobrý ten, zkušební odeslání kontaktního formuláře';` it working fine – Sarwar A Kawsar Feb 11 '20 at 16:32

1 Answers1

0

Try with smtp, put this code in functions.php file and it will allow smtp email using wpmail

add_action( 'phpmailer_init', 'configure_smtp' );
function configure_smtp( PHPMailer $phpmailer ){
    $phpmailer->isSMTP(); //switch to smtp
    $phpmailer->Host = 'mail.mydomain.com';
    $phpmailer->SMTPAuth = true;
    $phpmailer->Port = 25;
    $phpmailer->Username = 'Username Here';
    $phpmailer->Password = 'myemailpassword';
    $phpmailer->SMTPSecure = false;
    $phpmailer->From = 'From Email Here;
    $phpmailer->FromName='Sender Name';
}
Ravi
  • 319
  • 2
  • 9