• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Same email to two addresses and message spacing is different

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Same email to two addresses and message spacing is different

    My RBS Worldpay php feedback thing is almost groovy now apart from one annoying problem. The customer is getting:

    Name
    Address1
    Address2 etc

    While in my copy it's

    Name

    Address1

    Address2 etc

    It's the same darn message!! Only the recipient, title and headers have changed in the code. Annoying, as want to just cut and past email to create invoice.

    Any ideas why it should do this?? Cheers.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    #2
    If I stick my personal email address in the code it's ok. If I stick my company email in which is redirected to the same address I get extra spaces!
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    Comment


      #3
      I get this occasionally too, found this but I don't know WTF they're all on about to be honest. Double line breaks in mail body [Archive] - CodingForums.com

      My webmail is even more annoying, the message looks fine when I send but it arrives without any line breaks at all, it looks like it was typed by a right spaz which doesn't bode well when you're trying to get an agent to take you seriously.
      Science isn't about why, it's about why not. You ask: why is so much of our science dangerous? I say: why not marry safe science if you love it so much. In fact, why not invent a special safety door that won't hit you in the butt on the way out, because you are fired. - Cave Johnson

      Comment


        #4
        RFC2821 Simple Mail Transfer Protocol section 2.3.7 says that mail should use carriage return/linefeed (CR/LF, aka "\r\n", hexadecimal: 0D 0A) as end-of-line delimiters, and that SMTP clients should if necessary convert lone CRs or LFs to that form.

        However, this is a complex issue and much depends on the configuration and platforms used at each step. For example, some PHP installations will be talking to sendmail directly, but others will be going through a wrapper application of some kind before reaching the SMTP application: in that case, it may well be necessary to use platform-specific line endings (e.g. LF for Unix, "\n", 0A) despite what the PHP documentation says.

        As you seem to be getting the problem when the mail is forwarded through your other address, I suspect that the mail server doing the forwarding is incorrectly interpreting the line endings and ends up duplicating at least one of them; it's then down to your mail client how it interprets them. If you examine the raw source of the message with a hex dump utility, you may find that 0D 0A has been turned into something like 0D 0D 0A.

        Check your PHP script to see what line endings it's placing in the body of the mail. If it's using "\n" try replacing it with "\r\n", and vice-versa. N.B.: don't make this change to any part of the script that's generating the email headers if they are working correctly: only change the bit that's creating the body of the message.

        Rather than messing about with the current script, it would make more sense to extract the relevant code into a separate script where you can experiment to your heart's content. If you find a solution you can then apply that to the existing script, but you don't want to break the existing one.

        Comment


          #5
          Cheers chaps. It is definitely only with forwarded mails, though both with same host anyway. Anoying not to know what customer is actually looking at.

          Nick, I always have test versions, have a complete test mode version of my site. Right not want to break anything as I have little knowledge of server side stuff although starting to grasp php a bit.

          Anyway, if anyone needs a nice short callback script it's all working.
          bloggoth

          If everything isn't black and white, I say, 'Why the hell not?'
          John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

          Comment


            #6
            PS I did put this in code early on to try and sort problem. \r\n didn't seeem to give me any breaks at in some eamils

            $addr = "{$_POST['M_orderaddr']}";
            $addr = preg_replace('/\n/', "\t", $addr);
            $addr = preg_replace('/\t/', "\n", $addr);
            bloggoth

            If everything isn't black and white, I say, 'Why the hell not?'
            John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

            Comment

            Working...
            X