Jump to content

Need help in removing empty lines from an email sent out.


bardin

Recommended Posts

Hi there, im having trouble with this php file. Basically in this file, the person enters there information and an email is sent out to myemail@email.com where the persons info is displayed (the stuff they put in)

 

What then happens is that the info is displayed by the spacing between the information is to big, for examle.

 

Name: John Does    Address: Where at where street

 

Company: Doe Company

 

The space between the name and company im trying to remove all together, any hints, here is the php script code.

 

<?php

error_reporting(E_ALL ^ E_NOTICE);

 

require_once("includes/functions.mysql.php");

require_once("includes/config.php");

 

 

$posted=$_POST;

array_walk($posted, "postSanitize");

 

$formname=$posted["formname"];

 

if ($formname == "") {

  // we have nothing to process, bail

  exit;

}

 

 

dbconnect();

 

switch($formname){

 

  case "demo":

 

      $sql="insert into demo values(

      '',

      ".sql_quoted($posted["name"]).",

      ".sql_quoted($posted["company"]).",

      ".sql_quoted($posted["address"]).",

      ".sql_quoted($posted["city"]).",

      ".sql_quoted($posted["province"]).",

      ".sql_quoted($posted["postal_code"]).",

      ".sql_quoted($posted["phone"]).",

      ".sql_quoted($posted["country"]).",

      ".sql_quoted($posted["email"]).",

      ".sql_quoted($posted["fax"]).",

      ".sql_quoted($posted["facility"]).",

      ".sql_quoted($posted["units"]).",

      ".sql_quoted($posted["how"]).",

      ".sql_quoted($posted["comments"]).",

      ".sql_quoted($posted["method"])."

      )";

 

      $completed=mysql_query($sql);

     

     

     

      /* start demo mail details  */

      $mailto = "myemail@email.com";

      $mailfrom = "support@windmill-software.com";

      $subject = "PM Worx Demo Request";

 

      $body="";

      $body.="Name: ".$posted["name"]."\r\n";

      $body.="Company: ".$posted["company"]."\r\n";

      $body.="Address: ".$posted["address"]."\r\n";

      $body.="City: ".$posted["city"]."\r\n";

      $body.="Province/State: ".$posted["province"]."\r\n";

      $body.="Postal Code/Zip: ".$posted["postal_code"]."\r\n";

      $body.="Phone: ".$posted["phone"]."\r\n";

      $body.="Country: ".$posted["country"]."\r\n";

      $body.="Email: ".$posted["email"]."\r\n";

      $body.="Fax: ".$posted["fax"]."\r\n";

      $body.="Type of Facility: ".$posted["facility"]."\r\n";

      $body.="# of Units: ".$posted["units"]."\r\n";

      $body.="How: ".$posted["how"]."\r\n";

      $body.="Comments: ".$posted["comments"]."\r\n";

      $body.="Chosen Method: ".$posted["method"]."\r\n";

      /* end demo mail details */

     

      # send email notification and capture result (true/false)

      $notified=notifyByEmail($mailto,$subject,$body,$mailfrom); 

           

     

      if ($completed) {

        # sql worked, this is the message that displays on page for a success

       

        # a limiter against $notified being set true can be placed here if desired/required at some point ... if $notified is not set to true then the notification email did not send properly

       

        # pick appropriate message dependong on the method of delivery chosen by user in form

        switch($posted["method"]) {

            case "download":

              # this is the message that displays on page for a success for download

              $message='<img src="images/thankyou_democd.gif" width="239" height="49">

 

 

              <a href="Downloads/Current/PMW.exe"><img src="images/logo_demo.gif" alt="Click here to download your Demo" />[/url]

              <p>We have received your request for a PM Worx demo download.  To download the demo, <A HREF="Downloads/Current/PMW.exe">click here[/url].  

              Remember, you will need to contact Windmill in order to register the demo after it has been installed.</p>

              ';

              break;

 

            case "mail":

              # this is the message that displays on page for a success for mailed CD

              $message='<img src="images/thankyou_democd.gif" width="239" height="49">

 

 

             

              <p>We have received your request for a PM Worx demo CD.  You should receive the CD in the mail in a few days.  

              Remember, you will need to contact Windmill in order to register the demo after it has been installed.</p>

              ';

            break;

        }

     

      } else {

        # there was an error processing sql, inform user to try again or request assistance

        $message='There was an error processing your demo request.  Please hit the back button in your browser and try again.  If the problem persists please contact us directly for your demo request.';

      }

     

  break;

 

 

  case "subscribe":

 

      $sql="insert into subscribe values(

      '',

      ".sql_quoted($posted["name"]).",

      ".sql_quoted($posted["company"]).",

      ".sql_quoted($posted["title"]).",

      ".sql_quoted($posted["city"]).",

      ".sql_quoted($posted["address"]).",

      ".sql_quoted($posted["postal_code"]).",

      ".sql_quoted($posted["province"]).",

      ".sql_quoted($posted["country"]).",

      ".sql_quoted($posted["phone"]).",

      ".sql_quoted($posted["email"]).",

      ".sql_quoted($posted["referred"]).",

      ".sql_quoted($posted["referrername"])."

      )";

 

      $completed=mysql_query($sql);

 

      /* start subscribe mail details  */

      $mailto = "myemail@email.com";

      $mailfrom = "worxwire@windmill-software.com";

      $subject = "WorxWire Subscription";

 

      $body="";

      $body.="Name: ".$posted["name"]."\r\n";

      $body.="Company: ".$posted["company"]."\r\n";

      $body.="Title/Position: ".$posted["title"]."\r\n";

      $body.="Address: ".$posted["address"]."\r\n";

      $body.="City: ".$posted["city"]."\r\n";

      $body.="Province/State: ".$posted["province"]."\r\n";

      $body.="Postal Code/Zip: ".$posted["postal_code"]."\r\n";

      $body.="Phone: ".$posted["phone"]."\r\n";

      $body.="Country: ".$posted["country"]."\r\n";

      $body.="Email: ".$posted["email"]."\r\n";

      $body.="Referred?: ".$posted["referred"]."\r\n";

      $body.="Referred By: ".$posted["referrername"]."\r\n";

      /* end subscribe mail details */

           

      # send email notification and capture result (true/false)

      $notified=notifyByEmail($mailto,$subject,$body,$mailfrom);

 

      if ($completed) {

        # sql worked, this is the message that displays on page for a success

        $message='<p>Thank you. You are now subscribed.</p>

        <p>Watch your inbox for the next edition of the WorxWire.</p>

        ';

      } else {

        # there was an error processing sql, inform user to try again

        $message='There was an error processing your subscription.  Please hit the back button in your browser and try again.  If the problem persists please contact us.';

      }

 

      require_once("includes/pagetop.php");

     

      echo $message;

     

      require_once("includes/pagebottom2.php");

 

  break;

 

  case "user_conference":

 

 

      $sql="insert into user_conference values(

      '',

      ".sql_quoted($posted["name"]).",

      ".sql_quoted($posted["company"]).",

      ".sql_quoted($posted["title"]).",

      ".sql_quoted($posted["city"]).",

      ".sql_quoted($posted["address"]).",

      ".sql_quoted($posted["postal_code"]).",

      ".sql_quoted($posted["province"]).",

      ".sql_quoted($posted["country"]).",

      ".sql_quoted($posted["phone"]).",

      ".sql_quoted($posted["email"])."

      )";

      #echo $sql;

     

      $completed=mysql_query($sql);

 

 

      /* start user_conference mail details */

      $mailto = "myemail@email.com";

      $mailfrom = "support@windmill-software.com";

      $subject = "2007 User Conference Registration";

 

      $body="";

      $body.="Name: ".$posted["name"]."\r\n";

      $body.="Company: ".$posted["company"]."\r\n";

      $body.="Title/Position: ".$posted["title"]."\r\n";

      $body.="Address: ".$posted["address"]."\r\n";

      $body.="City: ".$posted["city"]."\r\n";

      $body.="Province/State: ".$posted["province"]."\r\n";

      $body.="Postal Code/Zip: ".$posted["postal_code"]."\r\n";

      $body.="Phone: ".$posted["phone"]."\r\n";

      $body.="Country: ".$posted["country"]."\r\n";

      $body.="Email: ".$posted["email"]."\r\n";

      /* end user_conference mail details */

           

      # send email notification and capture result (true/false)

      $notified=notifyByEmail($mailto,$subject,$body,$mailfrom);

     

      if ($completed) {

        # sql worked, this is the message that displays on page for a success

        $message="<p>Thank you. Your registration will be confirmed shortly.</p>

        <p>See you September 18th!</p>";

      } else {

        # there was an error processing sql, inform user to try again

        $message='There was an error processing your demo registration.  Please hit the back button in your browser and try again.  If the problem persists please contact us directly.';

      }

       

  break;

 

 

 

}

 

dbclose();

 

 

# and Lastly, we display the HTMLpage with the message we loaded earlier

require_once("includes/pagetop.php");

 

echo $message;

 

include("includes/pagebottom2.php");

 

 

 

 

 

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.