This is the code to send the mail:
$to = $_POST['leadEmail'];
$subject = "my subject";
$message = ( $_POST['leadEmailPref'] == "html" ) ? $messageh : $messagep ;
$headers[] = "From: My Name <ny_name@gmail.com>";
$headers[] = "Content-type: ".$_POST['leadEmailPref'] ;
wp_mail( $to, $subject, $message, $headers );
When I go to my inbox, the message is sent as an attachment and I don’t see the message. Obviously I don’t want the attachment, and I want the person who receives the email to see the message immediately.
Your
Content-type:
is wrong. It should betext/html
ortext/plain
, nothtml
.$headers[] = "Content-type: text/".$_POST['leadEmailPref'] ;
You should try: