SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    new line in email, and decimal point

    hello, i have been trying to get a newline in an email, i have tried '\r\n' and i have also tried \n\n, i dont know where i am getting it wrong, and also i included a transaction amount ($tranx_amt) in the email, and it is coming up with 4 decimal places. the markup is below.

    $body = " Hello $cust_id\r\n";
    $body .= "We are happy to inform you that your order has been placed,\n\n Thanks for the making the payment of $tranx_amt ,\n\nYour Payment reference no is $orderno";.

    this is the header (the email also contains tables in the body thats why the html type is in the heading)

    PHP Code:
     $headers "From: donotreply@reacheasy.co.uk\r\n"
                
    'MIME-Version: 1.0' "\r\n"
                
    'Content-type: text/html; charset=iso-8859-1' "\r\n"
                
    'Bcc:notification@grant.co.uk' "\r\n"
    any ideas on the new line and the decimal places.

    cheers

  2. #2
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    930
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    If you are sending 'Content-type: text/html' then your message is in HTML. Newline in HTML is accomplished with the <br> tag.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    ok will try now

  4. #4
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thank for the info, please do you have any idea with the extra decimal points . intead of 7560.58 it is showing in the email as 7560.5800

  5. #5
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Use number_format() on your amount.
    PHP Code:
    $body .= "We are happy to inform you that your order has been placed,\n\n Thanks for the making the payment of "number_format($tranx_amt2'.') ." ,<br />Your Payment reference no is $orderno";. 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  6. #6
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    it is not recognizing the transaction amount it, the result is

    Hello username
    We are happy to inform you that your order has been placed, Thanks for the making the payment of ,
    Your Payment reference no is 63749966

  7. #7
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    930
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    number_format() cannot accept 3 parameters, there need to be 1, 2 or 4, like this:

    PHP Code:
    number_format($tranx_amt2'.'''
    BTW, if you use Content-type: text/plain then you can use \n as the newline.

  8. #8
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •