0

I'm trying to send personalized, individual emails to a list of people on a CSV file using an AppleScript + Apple Mail. Everything's working great, except that the sent messages are displaying with the first quote level on iOS (and in other mail clients).

Photo of indented quote level on iOS

Any ideas how to fix this?

set {lastname, eAddress} to getData()

repeat with i from 1 to count lastname
    tell application "Mail"
        activate
        set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"subject"}
        tell mymail
            make new to recipient at beginning of to recipients with properties {address:item i of eAddress}
            delay 0
            set content to "Hi Dr. " & lastname & "," & return & "Email Body"
            
        end tell
        --show message window (otherwise it's hidden)
        set visible of mymail to true
        --bring Mail to front
        activate
        send mymail
    end tell
end repeat


on getData()
    set colA to {}
    set colB to {}
    tell application "Microsoft Excel"
        
        activate
        tell active sheet
            set lastRow to first row index of (get end (last cell of column 1) direction toward the top)
            
            repeat with i from 3 to lastRow
                set end of colA to (value of range ("A" & i))
                set end of colB to (value of range ("B" & i))
            end repeat
        end tell
    end tell
    
    return {colA, colB}
end getData
Tyler
  • 1
  • I can't replicate the problem. when I run this script the salutation and email body get sent without any quote level applied. Is this the actual script you are running, or a cleaned-up version? Sometimes the devil is in the details... – Ted Wrigley Aug 31 '22 at 15:48
  • That's the exact one. Did you check the received messaged on iOS? I don't see any quote level applied when looking at the sent or received message in Mail on the Mac. It only shows on iOS or other mail clients (Fastmail). – Tyler Aug 31 '22 at 18:12
  • I just ran a different script to send a message and ran into the same problem. – Tyler Aug 31 '22 at 19:13
  • Ok, last update (sorry for all the posts; no clue what I'm doing really).. When looking at the Raw Message, ">" is added to the content causing the quote level increase. There is also a blank line at the of each email. If I remove the send command from the script, then manually remove the blank line from the body, and then manually click send, the message is sent properly. – Tyler Aug 31 '22 at 19:39
  • I checked the sent email on my iPhone and it came through just fine, no quoting. The only thing I can think is that your message is somehow getting forwarded rather than sent directly, because that's what I'd expect to see from a forwarded message. Is that possible? – Ted Wrigley Sep 01 '22 at 13:37
  • I don't think so? The same thing is happening with a super simple script too.(https://share.cleanshot.com/9qI6Og) For some reason, the content is starting with a ">". (https://share.cleanshot.com/TrCNeb) And when i manually remove that blank first line, the quote level is normal on all devices. – Tyler Sep 02 '22 at 03:06

0 Answers0