Jump to content

_INetSmtpMail and line breaks in body


Recommended Posts

I think I'm doing this right... I'm sending an email using _INetSmtpMail and I've stored my lines in an array without CR or LF. An example script is here:

Local $DupeTime = "22"

; Title of job
Local $Title = "MPOE 6.0.0.0E2 64-bit (4 Discs)"

; Set up array of labels and images
; The max number of jobs in PrimoDVD is 32
Local $Queue [32][2] = [["U:\Disc Labels\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 1 of 4 - RHEL 6.3 64-bit DVD.std", "U:\Disc Images\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 1 of 4 - RHEL 6.3 64-bit DVD.iso"], _
                        ["U:\Disc Labels\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 2 of 4 - Linux COTS 64-bit DVD.std", "U:\Disc Images\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 2 of 4 - Linux COTS 64-bit DVD.iso"], _
                        ["U:\Disc Labels\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 3 of 4 - Windows COTS 32-bit DVD.std", "U:\Disc Images\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 3 of 4 - Windows COTS 32-bit DVD.iso"], _
                        ["U:\Disc Labels\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 4 of 4 - Documentation 64-bit CD.std", "U:\Disc Images\MPOE\MPOE 6.0.0.0E2\64-bit\MPOE 6.0.0.0E2 - Disc 4 of 4 - Documentation 64-bit CD.iso"]]

Local $i

; Trim the Queue array down to actual size
For $i = 0 To UBound( $Queue, 1) - 1
  If $Queue[$i][0] = "" Then
    ReDim $Queue[$i][2]
    ExitLoop
  EndIf
Next

Local $QueueSize = UBound($Queue, 1)

Local $as_Body[$QueueSize + 1]
$as_Body[0] = "The job took " & $DupeTime & " to complete." & @CRLF

Local $DiscTitle
For $i = 0 To $QueueSize - 1
    $DiscTitle = StringRegExp($Queue[$i][0], '\\([^\\]*)\.std$', 1)
    $as_Body[$i+1] = $DiscTitle[0]
Next

MsgBox(0, "Array", $as_Body[0] & @CRLF & $as_Body[1] & @CRLF & $as_Body[2] & @CRLF & $as_Body[3] & @CRLF & $as_Body[4] & @CRLF)

I'm not actually sending the email in the above script. I'm just showing you all how I processed the strings. If I were to use $as_Body and send an email, the first line works as expected, but the rest get concatenated:

The job took 0 to complete.

MPOE 6.0.0.0E2 - Disc 1 of 4 - RHEL 6.3 64-bit DVD MPOE 6.0.0.0E2 - Disc 2 of 4 - Linux COTS 64-bit DVD MPOE 6.0.0.0E2 - Disc 3 of 4 - Windows COTS 32-bit DVD MPOE 6.0.0.0E2 - Disc 4 of 4 - Documentation 64-bit CD

If I add "& @CRLF" at the end of each line in the StringRegExp loop, I get this:

The job took 0 to complete.

MPOE 6.0.0.0E2 - Disc 1 of 4 - RHEL 6.3 64-bit DVD

MPOE 6.0.0.0E2 - Disc 2 of 4 - Linux COTS 64-bit DVD

MPOE 6.0.0.0E2 - Disc 3 of 4 - Windows COTS 32-bit DVD

MPOE 6.0.0.0E2 - Disc 4 of 4 - Documentation 64-bit CD

What am I missing? I suspect there's something wonky about the results from StringRegExp that are causing issues with _INetSmtpMail.

Edited by GPinzone
Gerard J. Pinzonegpinzone AT yahoo.com
Link to comment
Share on other sites

Okay, I found the issue. It's with Outlook, not AutoIT:

http://stackoverflow.com/questions/247546/outlook-autocleaning-my-line-breaks-and-screwing-up-my-email-format

I added a @TAB at the end of each entry and that fooled Outlook. Perhaps it would be better if I HTML encoded my body, but I don't see any way to do that with _INetSmtpMail.

Gerard J. Pinzonegpinzone AT yahoo.com
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...