Note that there are some explanatory texts on larger screens.

plurals
  1. POSending Plain Text Emails
    text
    copied!<p>I am trying to send plain text emails to a company who will be processing them for me. I am using the Swift Mailer library and as far as I can tell - I have no problems. But the company that I am sending the messages to says that they are coming into them with all of the data on a single line. When I send myself an email using this script it looks perfect - each piece of data is on a separate line.</p> <p>Here is the script I am using. It is very simple. </p> <pre><code>&lt;?php $to=""; $bcc=""; $subject = "Quote" ; $domain = $_SERVER['HTTP_HOST']; //Message $message = "Domestic Quote Request\n"; $message .= "Full Name: $_POST[name]\n"; $message .= "Email: $_POST[email]\n"; $message .= "Phone: $_POST[phone]\n"; $message .= "Pickup Date: $_POST[shipdate]\n"; $message .= "Pickup City or Zip: $_POST[pickupzip]\n"; $message .= "Drop Off City or Zip: $_POST[dropoffzip]\n"; $message .= "Year: $_POST[vehicleyear]\n"; $message .= "Make: $_POST[vehiclemake]\n"; $message .= "Model: $_POST[vehiclemodel]\n"; $message .= "Carrier Type: $_POST[carriertype]\n"; $message .= "This Quote is from $domain"; require_once 'lib/swift_required.php'; // Create the Transport // Mail $transport = Swift_MailTransport::newInstance(); // Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); // Create the message $the_message = Swift_Message::newInstance() // Give the message a subject -&gt;setSubject($subject) // Set the From address with an associative array -&gt;setFrom($_POST['email']) // Set the To addresses with an associative array -&gt;setTo(array($to)) -&gt;setEncoder(Swift_Encoding::get8BitEncoding()) // Give it a body -&gt;setBody($message, 'text/plain', 'us-ascii'); //Check is BCC Field is emtpy. if ( !empty($bcc) ) { //The BCC Field is not empty so set it. $the_message-&gt;setBcc(explode(',', $bcc)); } // Send the message $result = $mailer-&gt;send($the_message); } header("location:index.php?s=1"); ?&gt; </code></pre> <p>Here is an example of what the company is saying they are receiving:</p> <pre><code>Domestic Quote Request Full Name: Test Email: someone@somewhere.com Phone: 555-555-5555 Pickup Date: 07/02/2012 Pickup City or Zip: 12938 Drop Off City or Zip: 23981 Year: 2009 Make: Audi Model: A4 Carrier Type: enclosed carrier This Quote is from awebsite.com </code></pre> <p>And this is what I receive when I email myself.</p> <pre><code>Domestic Quote Request Full Name: Test Email: someone@somewhere.com Phone: 555-555-5555 Pickup Date: 07/02/2012 Pickup City or Zip: 12938 Drop Off City or Zip: 23981 Year: 2009 Make: Audi Model: M4 Carrier Type: enclosed carrier This Quote is from awebsite.com </code></pre> <p>The company said that they believed that the lead was being sent as free text instead of plain text. Is there such a thing? I have never heard of free text. </p> <p>Thank you in advance for the help. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload