Applescript for mail.app won't send attachment

I have an applescript to send a mail attachment but the mail sends without the attachment? Anyone know why?
set theContent to (current date) as string
set theSubject to "excel file"
set theTarget to "someone @someplace.com"
set theSender to "admin"
set theName to "some name"
set theAttachment to "mcp0_HD:Users:bill:Site:logs:deviceLogs.xls"
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theContent & return & return}
tell newMessage
make new to recipient at end of to recipients with properties {visible:true, name:theName, address:theTarget}
set sender to theSender
tell content
make new attachment with properties {file name:theAttachment} at after the last paragraph
send newMessage
end tell
end tell
end tell

If you are still having problems, then there is something wrong with your file that you are trying to attach, or your declaration of this variable:
set theAttachment to "mcp0_HD:Users:bill:Site:logs:deviceLogs.xls"
Examine that very carefully. It is also a good idea to use the *path to* nomenclature (see the Dictionary for *+Standard Additions+* for more details) to access a file in cases like these. For example, here is the pertinent portion of a script that I have used since the Panther days to do precisely what you are trying to do:
set pay_Path to ((path to documents folder as text) & "Cathouse:Payroll:Paysheets:Today.xls")
tell application "Mail"
set b to make new outgoing message with properties {sender:"[email protected]", subject:("Payroll")}
set content of b to "Hello:
Here is the payroll ending today: " & return & return
tell b's content
make new attachment with properties {file name:pay_Path as alias} at after the last paragraph
end tell
tell b to make new to recipient with properties {address:"[email protected]"}
send b
end tell
I use this every other week to report my payroll to my accountant. It has never failed, and I am using Leopard (10.5.7).
Good luck,

Similar Messages

  • Mail app won't send mail, but it will receive mail

    The mail app on my macbook pro and iphone will not send mail, but they can recieve mail.  I deleted both accounts and reloaded them and they still won't work.  After that I ran repair permissions and it found nothing wrong.  Has anyone experienced this problem and how can I fix this?

    I had same problem with my MBA and Mac Desktop (don't have iPhone)...could receive but not send emails after Lion upgrade.  I only experienced it at home versus at work (inconsistently on both on my macbook air and my desktop mac).
    For me the solution was when you compose an email there are two dropdown listboxes next to From:  ...in the second one select smtp.me.com:yourusername   Until Apple makes a change you might need to do that each time you send or reply to a message.
    I think it has something to do with if you don't do that then port 25 might get used which can be blocked by a lot of ISPs.
    Apple support helped me solve this problem and said it was a known issue they are working on.
    Hope this helps with your issue!

  • Mail app won't send mail to my .me or .mac account

    My ISP is roadrunner in Rochester, NY.  On my iMac, running Tiger, my wife, in her account, can send and recieve email just fine using her roadrunner mail account with the mail app. The problem is that wen she sends email to my .mac or .me account, it doesn't reach me. There are no error messages and the mail successfully shows up in her sent folder. In comparison, I have my roadrunner account set up so that it forwards all my mail to .me. If she sends me mail using my roadrunner address, it reaches me.
    Does anyone have any idea why her account is failing at sending mail to .me or .mac but works with everything else?

    Most if not all internet service providers (ISPs) now block the use of SMTP servers that are outside of their network or not provided by the ISP on Port 25 which is the default or standard port for SMTP servers.
    Some ISPs allow the use of an authenticated SMTP server only (such as the .Mac SMTP server) on Port 25 but some block its use regardless.
    These restrictions are in place as part of an overall effort to prevent spam emanating from the ISP's domain.
    .Mac's SMTP server and Gmail's SMTP server are what is called Password authenticated. I don't know if the SMTP server for your school's account is authenticated.
    Do you not know who your internet service provider is which would be the ISP you use when connected to the internet at your apartment?
    If you weren't having any problems before, sounds like all these different networks with different ISPs that you use to connect to the internet don't block the use of an authenticated SMTP server and if you send messages with all three email accounts when connected to the internet with different ISPs, the SMTP server for your school's account must be authenticated also.
    Lets check the settings for .Mac's SMTP server. Go to Mail > Preferences > Accounts and under the Account Information tab for your .Mac account preferences at the SMTP server selection, select the Server Settings button below.
    The settings should be as follows:
    Outgoing Mail Server - or SMTP server: smtp.mac.com
    Server Port: 587
    Use Secure Sockets Layer (SSL): Can be selected or not selected.
    Authentication (Type): Password
    User Name: The portion of your .Mac email address in front of the @ sign only.
    Password: The account's password - the same password used to check the account for new messages.

  • Mail app won't send messages out

    I am logged into gmail on my iPhone 4 mail app. I tried to reply to a message yesterday and it wouldn't work. The message sat in my outbox saying "unsent" because I needed to go to my mail account settings and enter a password. Well I went to settings, mail, account, and my password was stored there. I re-typed it anyway to see what would happen. I went back to the mail app, and the message still has not sent. But now I don't have an Outbox folder on the main page either! The only way I know it's still unsent is because when the app refreshes, it says 1 Unsent Message on the bottom of the screen.
    So my question is, what is going on, where did my outbox go, why did it tell me to enter a password, and most importantly, why won't my message send?!
    I was connected to wifi, if that makes a difference. And does it make a difference if it was a reply versus a new message? I just tried a test email, connected through 3G, and it says it sent.

    Something stuck in the cache? Try a reset. To reset the iPhone, press and hold the home and sleep/wake buttons until you see the Apple logo (ignore the slide to power off prompt).

  • Mail App won't Send Mail on Macbook Air, Outlook works fine

    Mail app will no longer send, from my new 2011 Macbook Air with Lion. The MS Outlook app sends fine.

    This was the answer:
    This happened to me after updating to Lion. This is what I did.
    When mail tries sending/receiving you'll see the spinning icon next to the trays on the left hand side. Whilst this is happening click onwindow>Connection Doctor. Find the offending account, red dot, double click on the account and in the window that opens check the details inAccount Information and Advanced are correct; mine weren't and when I corrceted them, all was well. These details semed to be different to those I had set in the Preferences pane of mail.
    Good luck,
    Andy
    what this does is guide you through editing the smtp port list, which is a bit hard to locate on the accounts screen.
    mail cycles through the possible smtp ports, which can take a VERY long time. Usually 587 is what you want, but in any case, pick one, see if it works, tell it not to cycle.

  • Mail app won't send attachments

    A few days ago my macbook pro stopped sending email with attached files, and so did my wife's macbook (both running snow leopard at the start of the problem). Regular mail is sent but both sending an receiving is painstakingly slow. Progress bar appears but near the end the transfer rate slows to reach zero and stays there forever.
    Webmail access to my account won't let me send attachments either.
    Problem happens with yahoo plus, hotmail and workplace mail servers. Also from home (through broadband telephone access connected to an airport extreme base station) or from wifi access at work, at work downloading messages is fast though. Doesn't happen when sending through my ipad2.
    I have reset the broadband modem and base station, rebuilt permissions in both computers, changed MTU settings and upraded my macbook pro to lion with no success.
    Any ideas?

    I don't think so because I used to send 2MB or 3 MB files with no problem and now it won't let me send a 60K word document. It also happened out of the blue, no system updates or preference tweaking whatsoever.

  • Ipad mail app won't send hotmail emails

    I'm having trouble sending emails from my hotmail account. Every time I try it comes up with "cannot send mail - an error occurred while delivering this message"
    I have try closing and reopening the app, rebooting the ipad, removing and adding the hotmail account....all did not work
    Any other ideas?

    I had this issue and this was what worked for me, I was using the "hotmail" option.
    1. go to settings
    2. go to mail, contacts, calendars
    3.delete your email from device
    4. click "add account"
    5. there should be different account options, chose "other"
    6. chose "add mail account" and do so
    You  should be able to send now, but you might want to check how it updates.  Certain email options used "push"  which lets you know you have a new  email the moment you get it, much like a text message. "Other" only  allows you to have "fetch" which updates every selected amount of  mintues, and "Manual" which does exactly what it says.
    7. It should return you to the mail, contacts, calendars page. Press "Fetch New Data"
    8.  there will be a list of when it will update your email. The less it  updates, the easier it is on battery life. There is a manually option.
    9. If you want to use the actually "Manual" Update schedule then press "Advance" then your account.
    10. There you can chose "Fetch" (which I suggest if you use email a lot and there is a manual option there anyways) or "Manual"
    I really hoped this helped! If it did then well....awesome.

  • Mail app won't send

    always the message...
    cannot send messag using the server...
    use the pop up menu below to try a different outgoing mail server. all messages will use this server until you quit mail or change your network settings.
    here's the catch -
    it used to work...until 3 or 4 days ago. i have 3 accounts to the application and none of them will send. i get mail, just can't respond through Mail.
    tried deleting the outbox folder like suggested to someone else for whatever problems they had and still no luck.
    its causing me much anger. any suggestions?
    macbookpro   Mac OS X (10.4.8)  

    Most if not all internet service providers (ISPs) now block the use of SMTP servers that are outside of their network or not provided by the ISP on Port 25 which is the default or standard port for SMTP servers.
    Some ISPs allow the use of an authenticated SMTP server only (such as the .Mac SMTP server) on Port 25 but some block its use regardless.
    These restrictions are in place as part of an overall effort to prevent spam emanating from the ISP's domain.
    .Mac's SMTP server and Gmail's SMTP server are what is called Password authenticated. I don't know if the SMTP server for your school's account is authenticated.
    Do you not know who your internet service provider is which would be the ISP you use when connected to the internet at your apartment?
    If you weren't having any problems before, sounds like all these different networks with different ISPs that you use to connect to the internet don't block the use of an authenticated SMTP server and if you send messages with all three email accounts when connected to the internet with different ISPs, the SMTP server for your school's account must be authenticated also.
    Lets check the settings for .Mac's SMTP server. Go to Mail > Preferences > Accounts and under the Account Information tab for your .Mac account preferences at the SMTP server selection, select the Server Settings button below.
    The settings should be as follows:
    Outgoing Mail Server - or SMTP server: smtp.mac.com
    Server Port: 587
    Use Secure Sockets Layer (SSL): Can be selected or not selected.
    Authentication (Type): Password
    User Name: The portion of your .Mac email address in front of the @ sign only.
    Password: The account's password - the same password used to check the account for new messages.

  • Ipad mail app won't send Virgin emails

    I can receive emails on my Virgin account but when I try to send, I get the following message -
    A copy has been placed in your Outbox.  The sender address <my [email protected]> was rejected by the server.
    Please can any one help?  Thanks

    Hello EllieVelwell,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iOS: Unable to send or receive email
    http://support.apple.com/kb/ts3899
    Best of luck,
    Mario

  • Mail app won't show photos

    This problem exists in all three new iPhone 4s's in my family:  The Mail app won't display some photos attached to emails.  Some photos show up, others don't.  All are jpeg's with the proper .jpg appendage, all are relatively small files (approx 200kb).  The ones that show up and the ones that don't are the same in all three iPhones.  The photos all do show up on desktop and laptop computers.  On the iPhones, in Settings/Mail, Contacts, Calenders/Load Remote Images is turned on.  I tried turning the setting off, then on, tried rebooting the iPhone, nothing works.

    lou tetl,
    The list in iTunes under the Info tab is the list of accounts you can transfer the settings for from your computer directly to the iPhone.
    It is not a list of the accounts on the iPhone, or a list of all accounts on your computer.
    Hope this helps,
    Nathan C.

  • Sobriety check for Mail.app

    Hi everyone,
    I've been asked at work if it is possible to add this functionality to Mail.app, in a similar vein to what Gmail has recently added to their service.
    In a nutshell, what I need to create is an alert dialog that pops up when a user clicks the send button in Mail that allows them to confirm they want the message to be sent. It's not really a sobriety check (at least I hope not) but really a chance for an employee to avoid mistakes in their email message before it goes out.
    At this point I'd just like to know if it's feasible before I go down this route and if anyone has any advice for an AS noob looking to do this. Bonus points if you know whether it's possible to add a modifier to the Send button to bypass the script.
    Thanks much!

    Not directly - at least not via AppleScript.
    Mail.app supports AppleScripts for scanning incoming mail messages. There is no support for AppleScript on outgoing messages.
    It is possible to write Mail.app plugins, but they're not well documented (search for 'Mail.app plugin' for an idea) and requires an understanding of Objective-C.
    The last option I can think of is to not use Mail.app's automatic send/receive. Instead using a stay-open AppleScript to periodically get mail and check for messages in the outbox. If it finds any it posts the question then sends the message(s). The problem with this approach, though, is that it's far from foolproof (the user can send the message manually by enabling automatic mail sending).

  • Mail.app won't leave my password field blank.

    mail.app won't leave my password field blank on OS X Mavericks. I need it blank for security.  How to fix?

    anyone, anyone? I switched from a Windows desktop, and frankly, have had little but problems with the supposedly perfect mac... At least I could send **** emails on my Windows machine...

  • How to enable logging for mail.app in Mountain Lion

    I am at my wits end trying to figure this out....
    Does anyone have a clue how to enable the logging for mail.app under Mountain Lion?
    In the past, you could open up Console and click on Console.log and see the logging of mail. Under mountain Lion, there is no more console.log. I cannot figure out how to enable it.
    I have tried to run the AppleScript of "Turn On Logging" but the script errors out under Mountain Lion.
    Does anyone know how to do this or a better way, maybe a tool or something that can help you troubleshoot mail.app issues?
    Thanks in advanced

    Hello,
    I have a similar problem. The script "Turn on Logging.scpt" runs without error, but I do not see any socket logging. I only get two messages, which I also get when I start mail without the script by just clicking the mail.app icon in the dock. The Messages are:
    1/10/13 3:43:32.618 PM Mail[11276]: Using V2 Layout
    1/10/13 3:43:36.388 PM Mail[11276]: *** -[IADomainCache init]: IA domains cache is out of date.
    Any help would be appreciated

  • Mail.app won't work properly after installing Yosemite

    My "new viewer window" in Mail.app won't work after installing Yosemite. I can not access the viewer window and thus none of my email.
    How can I fix this?
    Mail.app v 8.0

    some updates on this issue, Mail application uses the same proxy that has been set on your system (system preferences==>Network==>Advanced==>proxies). People usually use HTTP/HTTPS proxy for surfing the web. You should make sure to set SOCKS proxy as well. Mail application works with SOCKS proxy. Note that port number for SOCKS proxy is usually different from the port number for HTTP and HTTPS but the IP address of  your server (apparently) is the same.
    Hope this helps

  • Mail app won't launch: "No Info.plist file in application bundle..."

    Hi -
    I'm running 10.6.8 on an Intel iMac and haven't used Mail in a long time.  I tried to start it today and it won't launch.  I opened the Package Contents for the app from the Finder, and double clicked the Mail executable.  It launched in a Terminal window and gave the following error message:
    Last login: Thu May 24 12:17:01 on ttys000
    /Applications/Mail.app/Contents/Mail ; exit;
    imac:~ Bill$ /Applications/Mail.app/Contents/Mail ; exit;
    2012-05-24 12:37:01.769 Mail[26585:903] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
    logout
    I looked and there is a file called Info.plist in the folder and it even has the string NSPrincipalClass in it.  Beyond that, I am clueless! 
    Any help much appreciated!
        Bill

    I would download and run the OS X 10.6.8 Combo update.
    I peeked into it with Pacifist, and it contains an update for Mail.app, including replacements for the executable and the info.plist:

Maybe you are looking for