Send eMail w/Attachment

Description

This AppleScript will ask you to input an email address, then it will send a specified attachment and message to that particular email address.
This is perfect for forms or instructions that you may have to send to users from time to time.

About the Author

Source Code

Important Note:
This script has not been checked by Spiceworks. Please understand the risks before using it.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

--Get Attachmenttellapplication"Finder"setfolderPathtofolder"Macintosh HD:Users:your_user_here:Documents:AutoMail"--Folder where attachment is storedsettheFiletosecondfileinfolderPathasaliassetfileNametonameoftheFileendtellsettheAttachmenttotheFilesettheSubjectto"Auto eMail with Attachment"--Subject of the emailsettheSenderto"example@email.com"--Sender of the emailsettheSignatureNameto"Signature #1"--Name of the Signature to be usedsettheContentto"Hi,This is the body of the email that was sent to you automagically via AppleScript. Thanks."settheRecipienttothetext returnedof(display dialog¬"Please input the recipient."defaultanswer¬"recipient@email.com"hiddenanswerfalse¬buttons{"Okay","Cancel"}¬defaultbutton¬"Okay"withtitle¬"Send eMail AppleScript"withiconnote¬givingupafter100)--Send Emailtellapplication"Mail"activatesettheMessagetomakenewoutgoingmessagewithproperties{visible:true,sender:theSender,subject:theSubject,content:theContent}setmessagesignatureoftheMessagetosignaturetheSignatureNametelltheMessagemakenewtorecipientwithproperties{address:theRecipient}trymakenewattachmentwithproperties{file name:theAttachment}atafterthelastwordofthelastparagraphsetmessage_attachmentto0onerrorerrmess-- oopslogerrmess-- log the errorsetmessage_attachmentto1endtrylog"message_attachment = "&message_attachmentsendendtellendtell