• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Create an email with an attachment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create an email with an attachment


  • Subject: Re: Create an email with an attachment
  • From: Henry Halff <email@hidden>
  • Date: Tue, 27 Jun 2006 09:25:42 -0500

Try something like this.

property theSubject : "PQMS Report for the Week"
property theBody : "Here is the PQMS Data for the week."
property recipientName : "Geoff Lilley"
property recipientAddress : "email@hidden"
property weeklyReport : "Detail Summary.xls"
tell application "Mail"
set response to display dialog "Recipient name:" default answer recipientName
set recipName to text returned of response
set response to display dialog "Recipient email:" default answer recipientAddress
set recipAddr to text returned of response
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell newMessage
set visible to true
-- I used a dialog box to get the path to the attachment. You can substitute weeklyReport
-- if you make it into a path.
make new to recipient at end of to recipients with properties {name:recipName, address:recipAddr}
set myFile to choose file with prompt "Select attachment"
make new attachment at end of content with properties {file name:myFile}
end tell
activate
end tell


On Jun 27, 2006, at 1:51 AM, Geoff Lilley wrote:

Hello.  This is my first post to the list.  I'm a script newbie.

All I want to do is send an email from Mail.app, with an attachment.

The attachment name will change, but not by much.  It will always start with the words "Detail Summary Report."

This is what I have so far:

property theSubject : "PQMS Report for the Week"
property theBody : "Here is the PQMS Data for the week."
property recipientName : "Geoff Lilley"
property recipientAddress : "email@hidden"
property weeklyReport : "Detail Summary.xls"
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell newMessage
-- Default is false. Determines whether the compose window will
-- show on the screen or whether it will happen in the background.
set visible to true
make new to recipient at end of to recipients with properties {name:recipientName, address:recipientAddress}
end tell
activate
end tell


If it's not asking for the absolute impossible, I want to be able to get the recipient's a name 
and address from a prompt.  

--
Henry M. Halff                                         210-348-9540
Halff Resources                                  (fax) 210-568-4165
402 W. Rhapsody, Suite 110                      (cell) 210-363-7501
San Antonio, TX 78216                 
http://www.halffresources.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Create an email with an attachment (From: Geoff Lilley <email@hidden>)

  • Prev by Date: Re: Add/Remove from Dock?
  • Next by Date: Re: Add/Remove from Dock?
  • Previous by thread: Create an email with an attachment
  • Next by thread: Re: Create an email with an attachment
  • Index(es):
    • Date
    • Thread