Bizarre formatting issues building text email with VBScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zoehart
    New Member
    • Oct 2006
    • 2

    Bizarre formatting issues building text email with VBScript

    I'm working with VBScript to build a text email message. I'm seeing a variety of bizarre formatting issues. The following lines of code

    MT = MT & vbCrLf & "Card Type: " & CardType
    MT = MT & vbCrLf & "Credit Card Number: " & objBOWallet.Enc rypt(Payment.[_account_number])
    If Not IsNull(Payment.[_expiration_mon th]) Then
    MT = MT & vbCrLf & "Expiration Month: " & Payment.[_expiration_mon th]
    End If
    If Not IsNull(Payment.[_expiration_yea r]) Then
    MT = MT & vbCrLf & "Expiration Year: " & Payment.[_expiration_yea r]
    End If
    MT = MT & vbCrLf & "Payment Amount: " & Context.DataFun ctions.Money(Pa yment.payment_a mount)

    results in the following text in the email:

    Card Type: Visa
    Credit Card Number: ?Hn<j;?AKPBROcT YPSiUjk Expiration Month: 7 Expiration Year: 2008 Payment Amount: $25.34

    with Space characters where there should be CRLF characters. Changing the second line from
    MT = MT & vbCrLf & "Credit Card Number: " & objBOWallet.Enc rypt(Payment.[_account_number])
    to
    MT = MT & vbCrLf & "Credit Card Number: " & Tab(1) & objBOWallet.Enc rypt(Payment.[_account_number])
    (adding the Tab(1)) "fixes" the problem, but I can't see why. Why would a Tab character in one line impact the CRLF characters in three subsequent lines?

    The most recent behavior is, to me, even more bizarre as I am now getting CRLF characters appearing in the middle of what are string literals in the code. For example, the following code

    If Not IsNull(OrderFor m.advcode) Then
    MT = MT & vbCrLf & "Affilate or Advertising code:" & Tab(1) & Trim(OrderForm. advcode)
    End If
    If Not IsNull(OrderFor m.Special_Offer ) Then
    MT = MT & vbCrLf & "Special Offer Code:" & Tab(1) & Trim(OrderForm. Special_Offer)
    End If
    MT = MT & vbCrLf & "Order Number:" & Tab(1) & OrderForm.Order Number

    results in the following text in the email:

    Affilate or Advertising code:Special
    Offer Code:Order
    Number: 10100625021

    Instead of getting CRLF characters before the "Special Offer Code:" and "Order Number:" strings, there are CRLF characters inserted into the middle of each string. I can't make head nor tails of what's going on. Has anyone seen anything like this???
  • zoehart
    New Member
    • Oct 2006
    • 2

    #2
    Never mind. I had my VBScript right the text out to a file and found that it was correctly formatted. Somewhere in the mail processing (mail server, mail client, SMTP stack) it's getting messed up. Not sure there's much I can do about that.

    Comment

    Working...