Jump to content

Recommended Posts

Hi,

 

I'm a noobie and having massive issues with a PHP script that sends an email to a user. The email is in plain text, yet the text is in double-spacing which is very frustrating. I have included the code below for you to examine. If anyone could help me to get the text back to single spacing that would be great.

 

<?php
$to  = $email;

$subject = 'Client Registration - XXXXX XXXXXXXXXXX';

$message = 'Dear '.$first_name.'

We recently sent you an email to announce our new website with
particular reference to your financial and classing data statements.

Our website has information about the XXXX XXXXX, our contact details,
including our regional Agents, market and price information, along
with your personal financial documents such as Recipient Created Tax
Invoices and Classing Data.

By providing this information on-line, you will be able to access your
personal information relating to business with XXXX more efficiently.
However, if you would like to receive your statements via an
alternative method, please don’t hesitate to contact us.

This email is to confirm that you now have access to the grower
section of our new website.

Your details are:
Your Email: '.$email.'
Your Username: '.$username.'
Your Password: '.$password.'

Please keep these details safe as they provide direct access to your
personal information.

If you have any questions or issues accessing our site or your
information, please contact me directly.

Thank you for your business and we hope we can continue our commercial
relationship going forward.

Yours Sincerely,


XXXXXXXX XXXXX / Director XXXX XXXXXXXX

Suite XX, Level X, XX Castlereagh Street | Sydney, NSW Australia
Tel: +61 2 XXXX XXXX | Mobile: +61 XXX XXX XXX | Fax: +61 2 XXXX XXXX
Email: xxxxxxxx Web: xxxxxxxxxx
';


$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";
$headers .= 'From: XXXX Xxxxxxxxxx <[email protected]>' . "\r\n";
$headers .= 'Reply-To: [email protected]' . "\r\n";

// Mail it
if (@mail($to, $subject, $message, $headers)){
$_SESSION['msg'] .= 'Email Sent to the new client.';
}
else {
$_SESSION['msg'] .= 'Email Failed.';
}	
?>

 

 

And this is how the text of the email turns out:

 

Dear Xxxxxx

 

 

 

We recently sent you an email to announce our new website with

 

particular reference to your financial and classing data statements.

 

 

 

Our website has information about the XXXX Xxxxx, our contact details,

 

including our regional Agents, market and price information, along

 

with your personal financial documents such as Recipient Created Tax

 

Invoices and Classing Data.

 

 

 

By providing this information on-line, you will be able to access your

 

personal information relating to business with XXXX more efficiently.

 

However, if you would like to receive your statements via an

 

alternative method, please don’t hesitate to contact us.

 

 

 

This email is to confirm that you now have access to the grower

 

section of our new website.

 

 

 

Your details are:

 

Your Email: [email protected]

 

Your Username: testtesting

 

Your Password: testtesting

 

 

 

Please keep these details safe as they provide direct access to your

 

personal information.

 

 

 

If you have any questions or issues accessing our site or your

 

information, please contact me directly.

 

 

 

Thank you for your business and we hope we can continue our commercial

 

relationship going forward.

 

 

 

Yours Sincerely,

 

 

 

Matthew Bradd

 

Director ECOM Australia

 

 

 

Suite 801, Level 8, 15 Castlereagh Street | Sydney, NSW Australia

 

Tel:     +61 2 9223 3631 | Mobile: +61 418 635 416

 

Fax:    +61 2 9233 6206

 

Email: [email protected]

 

Web: http://www.ecomcommodities.com.au/

 

 

 

If you could help me out here and show me how I can remove the double-spacing I would greatly appreciate it.

 

Many thanks,

 

Dan

  • 2 weeks later...

Hi,

 

It did appear to be working, but I have discovered another issue. The email formatting works fine being sent to my POP mail account, but the line breaks are not happening when the email is sent to my IMAP account. I believe this issue can be resolved if I put HTML into the mail via the PHP script. Can you please tell me how to insert HTML into the PHP script so the HTML appears in the email that is being sent?

 

Thank you once again for your help. It is invaluable.

 

Dan

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.