Hi,
before I upgraded to El Capitan, my script works fine. After last upgrades, new message was create right but without attachment.
The only way to send email with attachment is to put DISPLAYMAIL true (message is ok, but user must press SEND to send a new mail)
Anyone find a solution? (EXCEL MACRO)
Function MailFromMacWithMail(bodycontent As String, mailsubject As String, _
toaddress As String, ccaddress As String, bccaddress As String, _
attachment As String, displaymail As Boolean)
Dim scriptToRun As String
scriptToRun = scriptToRun & "tell application " & _
Chr(34) & "Mail" & Chr(34) & Chr(13)
scriptToRun = scriptToRun & _
"set newmail to make new outgoing message with properties " & _
"{content:""" & bodycontent & """, subject:""" & _
mailsubject & """ , visible:true}" & Chr(13)
scriptToRun = scriptToRun & "tell NewMail" & Chr(13)
If toaddress <> "" Then scriptToRun = scriptToRun & _
"make new to recipient at end of to recipients with properties " & _
"{address:""" & toaddress & """}" & Chr(13)
If ccaddress <> "" Then scriptToRun = scriptToRun & _
"make new cc recipient at end of cc recipients with properties " & _
"{address:""" & ccaddress & """}" & Chr(13)
If bccaddress <> "" Then scriptToRun = scriptToRun & _
"make new bcc recipient at end of bcc recipients with properties " & _
"{address:""" & bccaddress & """}" & Chr(13)
If attachment <> "" Then
scriptToRun = scriptToRun & "tell content" & Chr(13)
scriptToRun = scriptToRun & "make new attachment with properties " & _
"{file name:""" & attachment & """ as alias} " & "at after the last paragraph" & Chr(13)
scriptToRun = scriptToRun & "end tell" & Chr(13)
End If
If displaymail = False Then
' scriptToRun = scriptToRun & "send" & Chr(13) LINE COMMENTED DUE TO PROBLEM
End If
scriptToRun = scriptToRun & "end tell" & Chr(13)
scriptToRun = scriptToRun & "end tell"
If Len(toaddress) + Len(ccaddress) + Len(bccaddress) = 0 Or mailsubject = "" Then
MsgBox "Destinatario inesistente, errato o azione Email cancellata"
Exit Function
Else
On Error Resume Next
MacScript (scriptToRun)
On Error GoTo 0
End If