Applescript: enclosing a picture in Mail so it is in the body of the text

have a script on my server that sends mails using The Mail (Apple) Programme.
It encloses a picture situated on the desktop (the script is larger, where it generates the picture and trashes it afterwards).
Now the picture arrives as an enclosure and I would like it to appear at the end of the text (in other words in the body of the text not as an enclosure).  How do I amend the script I have?  I have no idea as to how to do this or where to begin.  any suggestions are welcome.
Thanks.
The script is the following at present:
set dFolder to "/Users/XYZ/Desktop/"
tell application "Finder" to try
   set tFiles to ((every file whose name contains "NameofPNG")) as alias list
on error
   set tFiles to ((every file whose name contains "NameofPNG")) as alias as list
end try
set docfolderpath to path to desktop folder as string
set yourfolder to "~/Desktop/" --------- the folder with the documents
set pathtoyourfolder to docfolderpath & yourfolder & ":" as string
set FNDVAR to "NameofPNG" --------"FIND" variable for the files
set ppath to quoted form of POSIX path of pathtoyourfolder
set theSender to "[email protected]"
set thercpnt to "[email protected]"
set theFiles to (do shell script "mdfind -onlyin " & "~/Desktop/" & " 'kMDItemDisplayName == \"*" & FNDVAR & "*\"'") ------seems to be faster than finder
set theattachmentspaths to {} ------preparing list for attachment paths
repeat with x from 1 to the count of paragraphs in theFiles
   set theF to alias POSIX file (paragraph x of theFiles)
   set end of theattachmentspaths to theF
end repeat
tell application "Finder"
   set theSubject to short date string of (current date) & (" XYZ")
   set theBody to "XYZ"
   tell application "Mail"
       delay 2
       set newMessage to make new outgoing message with properties {address:thercpnt, subject:theSubject, content:theBody & return & return}
       tell newMessage
           set visible to true
           set sender to theSender
           make new to recipient at beginning of to recipients with properties {address:thercpnt}
           repeat with y from 1 to count of items in theattachmentspaths
               delay 2
               set theAttachment to item y in theattachmentspaths
               tell content
                   make new attachment with properties {file name:theAttachment} at after the last paragraph
               end tell
               delay 2
           end repeat
       end tell
       delay 2
       send newMessage
   end tell
   activate
end tell

Looks complicated.  I looked at the source to an email with imbeded pictures.
The email contains multiple mime types.
Apple mail automatically imbeds the picture.
I your using someother email client, you need to create an html document with the pictures references.
example:
relatives and staff.<br></span></b><span style=3D"font-size:9pt;font-fa=
mily:&#39;Tahoma&#39;,&#39;sans-serif&#39;"><img src=3D"cid:X.MA5.139511246=
[email protected]" border=3D"0" width=3D"469" height=3D"334"><br><b><i>Mary Poppins=
<br></i>Erna Schenk, 78<br>
</b><img src=3D"cid:[email protected]" border=3D"0" width=3D"469" he=
ight=3D"334"><br><b><i>The Seven Year Itch<br></i>Ingeborg Giolbass, 84,=20
    und Erich Endlein, 88<br></b></span><b><span style=3D"font-size:24pt;fo=
nt-family:&#39;Tahoma&#39;,&#39;sans-serif&#39;">7.=20
No, I do not know what this 3D is all about.
follow: [email protected]
ignore the fact that this is made into an email link.
which references another mime:
Content-Type: image/jpeg; name="image.jpg"
Content-Disposition: inline; filename="image.jpg"
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
X-Attachment-Id: 160fdc512a07d156_0.0.6
/9j/4AAQSkZJRgABAQAAAQABAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdC
IFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAA
AADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFj

Similar Messages

  • In mail, my attachments, both photos and documents appear in the body of the message.  How can I get my attachments to appear as a separate attachment and not as part of the message.  Thanks for your help, Karen.

    In mail, my attachments, both photos and documents, appear in the body of the message.  How can I get my attachments to appear as a separate attachment and not as part of the main message????  Thanks for your help, Karen.

    softwater wrote:
    ...and costs $14.99
    Yep! And if you absolutely need (or think you need) that functionality, it is worth every penny.
    As Don already pointed out, exactly what the recipient sees will depend on how they've set up their machine and what unnecessary 3rd party apps they might've installed to display attachments the way they want.
    In theory, that is true. In practice, Attachment Tamer will cause more of your messages to show up as plain-jane icons on the other end. The problem is, after all, people running Outlook 2003 and 2007. These people likely aren't doing many system modifications.
    If I were you, I'd use the free solutions provided above, save my money and let my recipients decide how they will handle their mail.
    I completely agree.

  • When I want to attach a file to an e-mail I'm sending from my iCloud account it makes the file show up in the body of the e-mail instead of attaching it as a separate file the receiver can open.  How can I change this?

    When I want to attach a file to an e-mail I'm sending from my iCloud account it makes the file show up in the body of the e-mail instead of attaching it as a separate file the receiver can open.  How can I change this?

    It should be an attachment.  Your Mac just displays a preview of certain attachments (such as .pdfs) in the body of the message.  A PC, for example, will see it as an attached file rather than a preview.
    You can save the attachment on your Mac by Control-clicking on it and selecting Save Attachment.

  • I am unable to send a PDF attachment using mac mail so that it appears in the body of the email when arrives in the recipient's inbox.

    I attach the pdf file as a view in place instead of view as icon, but it arrives in the recipient's inbox as a pdf icon attachment.  I have heard that there are programs that can make the attachment be viewed in the body of the email, but i have been unable to find them.  Does anyone have any suggestions??  I have called apple care, and been to the genius bar, but nothing.  it seems that if the email is sent from mac mail to mac mail it works, but to any other mail program they only receive the icons.

    new account are created without a password, so asking for it is normal.
    see http://thunderbirdtweaks.blogspot.com.au/2011/07/pssswords.html
    Compare the passwords Thunderbird has for the other accounts and see if using the same one is what you need to do.

  • I posted in Mac pro Eplehust and Oslo in early June to change videokart (which has changed six months ago) got my Mac a month by mail, with the terrible damage the body, but the packaging in which he lay was not damaged. I sent him back to change t

    I have posted in Mac pro Eplehust and Oslo in early June to change videokart (which has changed six months ago) got my Mac a month by mail, with the terrible damage the body, but the packaging in which he lay was not damaged. I sent him back to change the computer, 4 weeks, I changed it and checked 2 more weeks. as a result of three days ago, got back, more than half the programs crash, I can not open or closed CDrom, some programs do not come off or stop, and stop responding commands, turn it off only mechanically, not any excuses, I did not get to the store, what should I do?
    My patience is crowded, nerves on edge, I have lost my time with the worst service of my life, the only thing I see its the draw Eplehuset and apple to court.
    my e-mail - [email protected]

    While writing I made a mistake... It is true I could become aware of the Scorpio incompatibility.
    I also tried the same identical procedure with a Seagate one. This disk and the same procedure was performed by some people I know on many MacBookPro Mid-2010 and everything was OK.
    We do not understand why this problenm occurs.
    Furthermore, If I installed the system on the broken HDD (that works, but sometimes it fails so badly and makes the system experience kernel panic) I could boot from it.
    I guess it is because of the **** Apple FIrmware written on the label.
    Is it possible that I cannot manage to boot from my new HDD because it has not a "special" feature on it that makes it compatible with apple??? Why making things so **** difficult my god a closer world like Apple one is impossible to imagine.
    However Shootist007 thanks for your message, but given what I said I do not think is a cable problem.

  • In Yosemite Mail, there is an issue where the signatures no longer toggle as in the past. If you change the existing signature, it just adds the new one vs replacing it within the body of the message. Thoughts?

    In Yosemite Mail, there is an issue where the signatures no longer toggle as in the past. If you change the existing signature, it just adds the new one vs replacing it within the body of the message. Thoughts?

    Hi howe.sc,
    When I checked for how signatures in Yosemite work, I found this.
    Mail (Yosemite): Include signatures in messages
    Delete a signature from a message: Select the signature, then press the Delete key.
    Replace a signature in a message: Delete the existing signature, then add a different signature.
    That sounds similar to what you are describing.
    Take care,
    Nubz

  • How can I send photos in mail as attachments instead of in the body of the message?

    I want to send photos as attachments to email instead of in the body of the message.  I have searched through preferenced in both mail and iPhoto but can find nothing that lets me do this.

    1. As Rysz says, Mail does send them as attachments. If seeing the preview is problematic for you, then right click on it in the Mail Message window and select 'Show as Icon'.
    2. If you're worried about how they are received... Mail defaults to sending RTF email. A few older applications on other OSes have problems with these. A lot of users on other OSes can't figure out how to set their Mail applications to work with them. If that's the problem, use Plain Text as Larry says.

  • I have a macbook pro with Lion OS and am using Mac mail.  How do I attach documents as attachments instead of coming up in the body of the email?

    How do I attach a file to mac mail without it going into the body of the email?

    To add to what Kappy said, note that you really can't control how some other mail client might display an attachment.  Some may display them inline, while others may require them to be opened separately.  And different people have different desires in this area...  some want a PDF file, for example, displayed inline, while others prefer for it not to be.  Just attach the file(s) and don't worry about this so much.
    Also, I do have to disagree with Kappy on one point...  I would not say that you "should" compress files and attach the compressed archive file.  That will force all mail clients not to display the attachment inline, but not everyone will want that (you'd be forcing your tastes on all recipients of your e-mail), and some people have difficulty figuring out how to open and view the contents of compressed files.  It's an extra step for you and an extra step for the recipient, and is not needed for most popular file types.  (Of course, we could advise you more specifically if we knew what file types you're dealing with.)

  • When I forward an email from my Mac Mail, the body of the email I just forwarded shows as an attachment in the recipients outlook.  Is there a way to change this so my clients don't have to open an attachment to read something that I forwarded to them?

    When I forward an email from my Mac Mail, the body of the email I just forwarded shows as an attachment in the recipients outlook.  Is there a way to change this so my clients don't have to open an attachment to read something that I forwarded to them?

    Open Terminal in Utilties and copy/paste
    This will send the attachment embedded inline. (This works in Snow Leopard, but not sure about Lion. Do a test first. If it doesn't work, just google "send attachment embedded + Lion." You don't actually have to send the message to see how it will appear.)
    defaults write com.apple.mail DisableInlineAttachmentViewing 0
    To reverse the setting, change the 0 to a 1
    However, whether this will work or not will depend on what the e-mail client on the receiver's end does with it.

  • HT1338 When I email an attachment with "Always Sent Windows-Friendly Attachments" checked, the result is a picture embedded in the body of the email, not a attachment.  What am I doing wrong.

    When I email an attachment (a .jpg file) with "Always Send Windows-Friendly Attachments" checked, the result is a picture embedded in the body of the email, not a attachment.  What am I doing wrong.

    1. "Always Send Windows-Friendly Attachments" has nothing to do with the display of attachments on either your machine or other ones. It's an esoteric setting that strips the resource fork from Mac files (that might have them) which could apper as a duplicate file on the Windows machine.
    2. Send Plain Text emails. Then it will always be received as an attachment.

  • How do I send a page via email in the body of the mail and not as an attachment?

    I wish to send a page via email in the body of the mail. The only option to send a page appears to be to save it first and then attatch to the mail.

    When you are in the Plan View, right click on the icon for the page that you want to omit from the menu. Near the bottom, you'll see Menu Options, click on that and you'll have the choice to Exclude Page from Menus.

  • I want to add a photo as an attachment and NOT have it pictured in the body of the email.

    I want to add a photo as an attachment and NOT have it pictured in the body of the email.
    When I click on the paper clip to attach, it always is pictured in the email.

    https://discussions.apple.com/message/16802006#16802006

  • Recruitment - automatic mail - text in the body of the e-mail

    Hi Experts,
    I'm facing an issue in the Recruitment!
    I managed to send e-mail attachment through transaction PBA5.
    However, the e-mails I send are "empty" and the standard text linked to the activitiy is attached (in a pdf format).
    Does anyone know how to "fill" the body of the e-mail? Just to introduce the attachement!
    Thank you very much!
    Regards

    Hi Ema,
    Please maintain the feature MAILS.
    Hope it helps you
    - Ashish

  • Why are my attachment images being embedded as distorted thumbnails in the body of the text in Mac Mail?

    Why are my attachment images being embedded as distorted thumbnails in the body of the text in Mac Mail? How can I attach image files as normal attachments?

    Attachments – Disable Embedded Attachments

  • After installing OS8 my mail items On my iPad in trash often are mixed up with the body of the email in the wrong email. The iPhone with the same mail in trash is fine, as is the GMail trash on my PC.

    I Have IOS 8.1 on my iPad & iPhone And I use gmail. When I review email trash on the iPad, many of the emails in trash have the wrong content. The body of the email appears as the content of another email also in trash. The same emails in trash on the iPhone & in Gmail trash on the PC are all OK. if I file the email back in the inbox it Still has the body of the email with the wrong sender and addressee. Any ideas?

    Greetings,
    Mail doesn't create .txt files from email messages; it sends exactly what you type. If some of your recipients are claiming they receive .txt files, that would most likely be due to their email client, which no doubt is running Windoze. Only they can solve that problem. If the message is okay in your Sent mailbox, that's exactly what you sent, so the problem is on their end.

Maybe you are looking for

  • Drawing with the line or shape tools

    This question was posted in response to the following article: http://help.adobe.com/en_US/indesign/cs/using/WSa285fff53dea4f8617383751001ea8cb3f-6c1fa.h tml

  • Struts portlet url posting

    Hi all, I am experimenting with a struts file upload portlet, trying to work around the fact that file upload directly to the PPE is not supported. Things work (quite) fine when I use the Struts HTML form (instead of the PDK Struts HTML) tag for the

  • Is it possible to restore deleted documents?

    I cleared my recent documents and I accidently deleted a couple of documents. HELP!

  • Can I use thunderbolt display to play xboxone?

    Can I use thunderbolt display to play xboxone? I just do not want to buy another TV, thanks .

  • How to do  Line Drawing

    Just how do I use a photo of a church building and make a line drawing of it? There are hundreds of lines, bricks, indented windows, steps,etc. and the whole thing is flooded with trees. They don't want a photo image and I've tried drawing it in PS 7