Made a form that e-mails content, but It looks horrible in an email. Need to make file upload compatible

I’m having trouble making my e-mail look better, such as with CSS because it looks like plain text:
enter image description here

Is there anyway to bold or something with html? I’ve tried concat with <b> tags but I don’t think it works because I’m assigning a variable. How can I make it look better? I’m using WordPress.

Read More

Also how can I make it File Upload compatible? Thanks

Here’s (part) of my code:

<?php

$message = "You have received a message from " . $fullname . ", See information below:" . "n" .
"nn" . "General:" . "n" .
"nFull Name: " . $fullname . "n" .
"nEmail Address: " . $email . "n" .
"nSubject: " . $Subject . "n" .
"nIssue Type: " . $issuetype . "n" .
"nn" . "Hardware:" . "n" .
"nOrder Number: " . $ordernumber . "n" .
"nOrder Date: " . $orderdate . "n" .
"nPhoto: " . $photo;


//php mailer variables
$to = get_option('admin_email');
$subject = "Customer Support Form Subject: " . $Subject . " By " . $fullname;
$headers = 'From: '. $email
?>

<?php 
if($_POST["submit"]){
  $sent = wp_mail($to, $subject, $message, $headers);
}
?>

Related posts

Leave a Reply

1 comment

  1. It seems you’re using wordpress and using wp_mail to send the email. The default content-type based on the wordpress codex page
    is text/plain. with that said you won’t be able to add styling to it unless you change the content type to text/html using wp_mail_content_type filter or add it to your $headers variable.

    Notice that I changed the n to <br /> and added additional header ($headers = 'Content-type: text/html;charset=utf-8' . 'rn';) to set the content type.

    <?php
    
    $message = "You have received a message from " . $fullname . ", See information below:" . "<br />" .
    "<br /><br /><strong>" . "General:" . "<strong><br />" .
    "<br /><strong>Full Name:</strong> " . $fullname . "<br />" .
    "<br /><strong>Email Address: </strong> " . $email . "<br />" .
    "<br /><strong>Subject: </strong>" . $Subject . "<br />" .
    "<br /><strong>Issue Type:</strong> " . $issuetype . "<br />" .
    "<br /><br />" . "Hardware:" . "<br />" .
    "<br /><strong>Order Number: </strong>" . $ordernumber . "<br />" .
    "<br /><strong>Order Date:</strong> " . $orderdate . "<br />" .
    "<br />Photo: " . $photo;
    
    
    //php mailer variables
    $to = get_option('admin_email');
    $subject = "Customer Support Form Subject: " . $Subject . " By " . $fullname;
    $headers = 'Content-type: text/html;charset=utf-8' . 'rn';
    $headers .= 'From: '. $email . 'rn';
    ?>
    
    <?php 
    if($_POST["submit"]){
      $sent = wp_mail($to, $subject, $message, $headers);
    }
    ?>
    

    Regarding adding attachments please check this post.
    https://wordpress.stackexchange.com/questions/50264/using-wp-mail-with-attachments-but-no-attachments-received