Apple script to send email

I need an Apple Script to send a generic email without it opening Mail does anyone know how to do this?

You need to have an open application to script. This is so even if you use Bash and postfix. I advise that you use AppleScript and let it open Mail.

Similar Messages

  • Forgot my security question and apple does not send email

    forgot my security answer and apple does not send email for the instrctions to reset

    Click here and request assistance.
    (76924)

  • Ping all the servers into SP farm using powershell script and send email only if any of them failed to ping.

    Hi,
    i am trying to have such kind of functionality, so that if any servers in sharepoint farm failed then it will send notification email to specific user that server is not able to ping or failed. Right now following script is working but it sending mail either
    servers are all running or dead. But i would like to send email only if any of the server failed to ping. what i need to modify following code to work.
    Thanks in advanced
    #### Provide the computer name in $computername variable 
    $ServerName = "localhost","Dc-XX"  
    $smtp = "ExchChange" 
    $to = "[email protected]
    $from = "[email protected]
    $sub = " Server Status" 
    $body = @" 
    ##### Script Starts Here ######   
     foreach ($Server in $ServerName) { 
                        if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {  
                            $body += write-output "$Server is alive and Pinging `n"  
                                } else { $body += Write-output "$Server seems dead not pinging `n"  
    $body 
    send-MailMessage -SmtpServer $smtp -To $to -Subject $sub -Body $body  -From $from   

    you need to put a check on the send-mailmessage if no ping fails then exit else send the email with message.
    also try this script, performing the the same thing but more granular way
    http://gallery.technet.microsoft.com/scriptcenter/d0670079-6158-4dc5-a9da-b261c70e4b7d#content
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Shell Script to send email with .txt file as attachment

    Dear Al,
    Could any one help me with code, for sending email with .txt file as attachment using shell script.
    Thank You!

    978334 wrote:
    Dear Al,
    Could any one help me with code, for sending email with .txt file as attachment using shell script.
    Thank You!http://bit.ly/XHfSCz
    https://forums.oracle.com/forums/search.jspa?threadID=&q=sendmail&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Script to send email notification when sql server stops..

    Hi,
    I am looking for a script through which I can monitor sql server service status and if it down for any reason, I want to send email to Dba team.  How to achieve this? Did anyone has already done similar kind of monitoring?
    Again, I am not looking for any 3rd party monitoring system like SCOM etc.. I looking for a batch file or script outside sql which can solve this.
    Any help would be greatly appreciated.
    Thank you.

    There are two ways to do it:
    1). There is a job option wherein you can put the alert message and then in schedule option, select to alert you only when Sql Agent Services get restarted. So this way you will come to know when Sql Agent Services got restarted.
    2). From any centralize\third server apart from your database server\host, you can put a job to execute almost around every 5 minutes to check service status and then call a batch file which will call OSQL code to execute sql code for sending alert
    based on the message content you want to like below:
    Scripts below, even you can tweak more on this as per your environment requirement and even you can merge some scripts to make one out of two or similar, however keeping each separate one helps to track scripts.
    First Batch File with Name: ServiceStatusCheck.bat
    with below content
    Echo "Checking Service Status"
    :Query
    FOR /F "tokens=4 delims= " %%A IN ('SC QUERY "XXXXXXXXServiceNametobeCheckedPutHere" ^| FIND "STATE"') DO SET status=%%A
    IF "%status%"=="STOPPED" GOTO Shootout
    :Shootout
    'email for success in first attempt
    'Put path of batch file
    "D:\Script\Successemail.bat"
    Exit
    Second Batch file with below content which will call Sql file to send alert: File Name: Successemail.bat
    ECHO "Send Email Alert"
    OSQL -E -S XXXXXXXXX -i "D:\Script\Successemail.sql"
    ECHO "Done"
    Exit
    Third Sql File to send email: File Name: Successemail.sql
    Declare @bodyT varchar(200)
    Set @bodyT  =
    'Service was found in stopped status and Date & Time::'
     +replace(convert(varchar(20),GETDATE(), 102),'.','/')
     +'::'
     +convert(varchar(20),GETDATE(), 108)
    EXEC msdb.dbo.sp_send_dbmail
        @profile_name='Profilename',
        @recipients = '[email protected]',
        @body  = @bodyT,
        @subject = 'Service was found in stopped status, Check Details!!'
    GO
    Santosh Singh

  • Eem applet or script for sending email for syslog denies

    I am wanting to have my isr's send an email when a certain number of deny's occur on an ace.  So if i have a particular ace set up to log when tcp 3389 denied.  Then the eem applet or script would track when that deny entry happens.  When the deny hits on that entry reach three times, it will send an email alert.  The thing i am wondering about is how to set a variable within an event syslog pattern statement.  For instance, how do i say express a variable for the source ip/port in the below
    config-applet)# event syslog pattern "SEC-6-IPACCESSLOGP: list 198 denied tcp 201.198.71.51(38531) -> 212.184.81.52(3389)" occurs 3
    The source ip and port could rotate or change so i'd need to express that with some kind of variable.  How could that be done?(or is there a better approach altogether). 

    I put the below script in and it takes fine but does not send email alert.  Is there something more to do for configuring email sending? 
    event manager applet Intrusion-Tracking
    event syslog pattern "SEC-6-IPACCESSLOGP:.*-> 208.195.174.115\(3389\)" occurs 3
    action 1.0 mail server "173.16.7.2" to ".[email protected]" from ".eem@company1." subject ".intrusion_alert_from_c2900isr." body "Intrustion alert c2800isr"

  • I am told Apple is blocking sending emails in Microsoft Outlook is this correct

    I have for approximatly the last 2 months been unable to send emails from the Microsoft Outlook (version for Apple) I always could but have been told by Microsoft this facility has been blocked by Apple to force Apple users to use Mac Mail is this true

    Might be good to see what Outlook:Mac users are saying here:
    http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macoutlook?tab=Thread s&status=&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=All&tm=1384 356885368
    I've used the forerunner of Outlook, MS Entourage, since Jaguar OS 10.2  was the hot Mac OS and never had any issues. Now I have Entourage managing my main mail acount and Apple Mail handling a secondary account and they work fine together.

  • Script to send Email notification depending on return value

    When I run this I get a report of users who's accounts is about to expire, a scheduled task that run, say every week. Only problem it that this will send an email report even if there is nothing to report. What I would like is: if any return value is given
    it sends the mail. If no return value is given it dosen't send any mail. I'm trying to get an if solution where if ($bodyoutstring return value -eq true) {send mailmessage} else {do nothing} But not sure this is possible since $bodyoutsring is a
    variable? Input in this matter is appriciated.
    ###Change these according to your own setup
    $smtpServer="smtpServer.com" #mailserver
    $from = "Scheduled task, <[email protected]>" #mail from
    $Recipient = [email protected] #mail to
    # Script start - Get Users From AD who have AccountExpirationdate: 32 days left
    Import-Module ActiveDirectory
    # Email Subject Set Here
        $subject="AD Accounts is about to expire."
    #Variabel collect info and out-string it into html
    $bodyoutstring = get-aduser -filter * -Properties * |Where-Object{$_.AccountExpirationdate -ne $null}| Select-Object Name, Description, SamAccountName,@{Name='DaysTilExpiration';Expression={($_.AccountExpirationdate - (get-date)).Days}}  | Where-Object
    {$_.DaysTilExpiration -le 32} | ConvertTo-Html| Out-String
    # Send Email Message
    Send-Mailmessage -smtpServer $smtpServer -from $from -to $Recipient -subject $subject -body $bodyoutstring -bodyasHTML -priority Normal
    # End Send Message

    Hi,
    You can do something like this:
    If ($bodyoutstring) {
    Send-MailMessage ...
    This way if no results are returned no email is sent.
    EDIT: Wait, I'm wrong. Since you're piping through ConvertTo-Html, you'll always get a result... Hold please.
    EDIT2: This version checks the users first, then does the test and converts only if it needs to:
    $userList = Get-ADUser -Filter * -Properties Description,AccountExpirationDate |
    Where-Object { $_.AccountExpirationdate -ne $null }|
    Select-Object Name, Description, SamAccountName,@{Name='DaysTilExpiration';Expression={($_.AccountExpirationdate - (get-date)).Days}} |
    Where-Object {$_.DaysTilExpiration -le 32}
    If ($userList) {
    $bodyOutString = $userList | ConvertTo-Html | Out-String
    SendMailMessage ...
    I've also changed your -Properties parameter to return only the properties you need. Using * will slow your query down.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Script to send email when Export Backup finish

    I have a 10g(10.2.0.3) database that I am running on windows. I have export backups running every day and would like to build a script that sends me an email after the backup is finished and also send me if it does not finish with error. Has anyone build this kind of script yet?

    If you're using a Windows batch file, you'd need a command line SMTP utility. A quick Google search shows that you're in luck-- there are a rather large number of these utilities in the world
    http://www.google.com/search?q=SMTP+Windows+%22command+line%22
    I've used BLAT (the third or fourth hit most likely) with good luck. Though I'm sure other tools would be equally good.
    I'd be hard-pressed to come up with an application requirement that would influence whether a database had to be backed up. I'd argue that a DBA should always be doing a physical backup of the database (hot or cold, depending on requirements). Otherwise, you potentially have to re-create the database, re-apply all the parameter changes you've made, re-apply any patches you've applied, run the import, figure out what didn't get imported or didn't get imported correctly, potentially adjust sequence values, etc.
    Justin

  • Huge problem using apple mail while sending email to a group...

    Hey - I am quite confused... apple mail has huge problems using groups with about 150 addresses when writing and sending an email... the writing of emails is nearly impossible. Once the group name is inserted in the addressline (address book in iCloud!), apple mail uses nearly 100% CPU and further writing is nearly impossible. When sending such an email, all addresses are suddenly visible - though the box is NOT checked and the addresses should be hidden... what can I do? I use this feature (sending mails to groups) on a daily basis and cannot accept visible addresses...
    Greetings and sorry for inconvenient english...
    Christof

    How about next time you send to the group, cc yourself, or include yourself in the group. Then receive the email on the iphone, you can "reply all" in order to send to the group. If you use an imap account, you can make a new folder, call it something like "groups", and save different group emails there for the next time you need to "reply all".

  • APPLE MAIL is sending emails from wrong address

    Hello,
    This question has probably been asked before, but I haven't been able to find it. Feel free to send me there with a link if it's helpful.
    Here's my plight:
    I use gmail IMAP and manage 2 email accounts through Apple Mail (5.2). One is the domain catch-all email, [email protected], and the other is my main personal account, [email protected] Usually, whichever mailbox I click on is the address from which my mail is sent. But recently, whenever I've sent mail from [email protected], the recipient has been seeing my personal address ([email protected]), rather than the Info address. But the address line still says "Info" and not my name, if that makes sense. Example:
    NORMAL: FirstName LastName "<[email protected]>"; Info "<[email protected]">
    NOW (PROBLEM): Info "<[email protected]>"
    The replies to the mail I sent from Info are then sent to my personal account. I checked the mail preferences and the Info settings are the same as they've always been. It says the name is Info and the address is [email protected] I'm not sure why Apple Mail is suddenly thinking that the Info emails are coming from my personal account. Is this an Apple Mail issue, or a Gmail issue? Help! I don't want people to be receiving emails from my personal account when it should be from the Info account. Do I need to delete the entire Info mailbox from Apple Mail and start all over?
    Thanks for your help!

    Agreed.  I had three gmail accounts, 2 business, one personal, but lately all my attempts to send mail from my personal account wound up being sent from Business instead, even after selecting which account to send it from.
    I went into Preferences, Account info, then found all outgoing smtp servers simply called gmail but there were three in the list. It turned out that all my accounts were being directed to one server address.
    If you drop down the Edit SMTP Server list, then select each account under Account Information you can see which server is dedicated to which account. Then you can edit the name of the related gmail server to the related account. So you can have gmail personal, gmail business 1, gmail business 2 etc.
    Once you have the servers renamed (all the same actually but tells mail which account credentials to use), you can then select the appropriate server to match the right account under Preferences>Account Info front page.
    Worked for me.
    10.9.1  MBP ret

  • Apple script to send imessage to all users in contact list.

    I was given this today to be completed today. I have this so far that I found from another post and modified it.
    tell application "Messages"
         set myid to get id of first service
         repeat with i in {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
         set theBuddy to buddy {i} of service id myid
         send "test" to theBuddy
        end repeat
    end tell
    It errors out when sending a message to myself. Even though my apple id is not in the contact list and if it reaches a number that is not registred with imessage it errors out.
    any suggestions?

    I think you're a little wide of the target here.
    In an ideal situation i would like to take all 118 people in my address book.
    Nothing in your script references your address book at all. Buddies on your buddy list don't necessarily match your Address Book contacts.
    Take their mobile number store it in a list and then send my message to them.
    You're also  referncing molibe numbers, not IM accounts, which are not the same thing. Are you planning on sending out SMS messages to these people? are you sure they're OK with that? Most providers charge for text messages so your plan actually costs your recipients money (assuming you're using a service that has a IM -> SMS gateway).
    I guess the system keeps an internal index of those numbers named "buddy" i don't know i'm just guessing here.
    When you ask Messages for a buddy, it's referncing names in your Buddy List (Window -> Buddies). That's the list it is iterating through.
    I would have liked to skip the manually sending a text message though.
    I thought the whole point of this was to automate the process, no?
    Management see's this as a good communication tool
    That might be the problem right there
    I'm going to have to figure out how to make it more usable than what it is now.
    It would help if you clearly defined your goals. It sounds like you want to send a message to a group of people in your address book. Since there are multiple communication methods (SMS, iChat, AIM, Google Chat, Yahoo, etc.) you need to clarify which method you want. Once you have a clearer idea of your goals it should be easier to work out the implementation.

  • Script to send email with user-friendly fields

    I like to make a script to help a friend who is not very computer fit (old).
    Working in an email programme is already challenging to him.
    So I have the following script:
    set theBody to "Hallo etc"
    set theSubject to "Subject etc"
    set theTarget to "xxx2zxy.com"
    tell application "Mail"
    set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
    tell newMessage
    make new to recipient at end of to recipients with properties {address:theTarget}
    set sender to "[email protected]"
    end tell
    send newMessage
    end tell
    and this works. Where I get stuck (lack of knowledge) is that I would like it to come up in a window with 3 boxes (one for the text, one for the subject and one for the email address). So all he has to do is write in those 3 boxes and hit OK.
    Can anybody help me here?

    Maybe something along these lines...
    *set theBody to text returned of (display dialog "Enter message text here " default answer "")*
    *set theSubject to text returned of (display dialog "Enter subject here " default answer "")*
    *set theTarget to text returned of (display dialog "Enter recipient's email address here " default answer "")*
    *tell application "Mail"*
    *set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}*
    *tell newMessage*
    *make new to recipient at end of to recipients with properties {address:theTarget}*
    *set sender to "[email protected]"*
    *end tell*
    *send newMessage*
    *end tell*
    Regards, Andrew99

  • Powershell scripting to send emails based on events in event viewer **PROBLEM IS SENDING attachment of log**

    $emailFrom = "[email protected]"
    $emailTo = "[email protected]"
    $subject = "$env:COMPUTERNAME : A VM was successfully migrated."
    $body = "$env:COMPUTERNAME : A VM was successfully migrated."
    $smtpServer = "smtp.domain.com"
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $smtp.Send($emailFrom, $emailTo, $subject, $body)
    this is a template of a ps1 script i wrote. This will send the above email based on a specific event ID for the microsoft failover cluster / operational, say ID 5143 for example. My question is how do i include in that script to also include a copy of the
    log for that event ID in the body of the email ?

    You problem with this code is that the SMTPClient send method does not handle attachements.
    Instead, try creating the message, using the system.net.mail.mailmessage class to create the message.Then create a mail attachment. Finally, add the attachment to the message. This allows you to craate an attachment, then use the SMTPServer object to send
    that mail.
    The code should look something like this:
    $To      = "[email protected]"
    $From    = "[email protected]"
    $Subject = "Using the .NET SMTP client."
    $Body    = "Using this .NET feature, you can send an e-mail message from an application very easily."
    # Create mail message
    $Message = New-Object System.Net.Mail.MailMessage $From, $To, $Subject, $Body
    $AttchmentText = get-content C:\foo\aaaaaaa.txt  # or whatever
    # Now create Attachement content type
    $ct = new-object System.Net.Mime.Contenttype
    $ct.name = 'text/plain'
    # Now create an attachment of that type
    $attachment = [System.Net.Mail.Attachment]::CreateAttachmentFromString($attchmenttext,$ct)
    # Next add Attachment to the message
    $message.Attachments.Add($attachment)
    # and now create smtp server
    $smtpServer = "COOKHAM8"
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $smtp.Send($message)
    I tested this script on my system and it works. You may need to play around a bit with the attachment, in terms of content type, etc.
    Thomas Lee <[email protected]>

  • Script to send email if any service failed

    Hi,
    I want to monitor all services on server. In case of a service failure, it will send an email to a particular email address. In this way administrator will be notified that there is a service failure, and he will take necessary measures.
    Any help will be highly highly appreciated.
    Regards,
    Anees

    strComputer = "."
    Dim objFSO1
    set objFSO1=Createobject("Scripting.Filesystemobject")
    if (objFSO1.FileExists("path to log file")) then
    objFSO1.DeleteFile("path to log file")
    wscript.sleep 3000
    end if
    if strComputer =  "" then wscript.quit
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colRunningServices = objWMIService.ExecQuery _
        ("Select State from Win32_Service where Name = 'ServiceName'")
    For Each objService in colRunningServices
        If objService.State <> "Running" Then
        ErrorMessage objService.Name  & VbTab & " is " & objService.State
        else
        ErrorMessage "Service is running"
        End If
    Next
    Sub ErrorMessage (ByRef strMessage)
    ' Create Log File
    Dim objFSO, objOutPutFile
    Const ForAppending = 8
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objOutputFile = objFSO.OpenTextFile("path to log file", ForAppending, True)
    objOutputFile.Writeline(strMessage & vbCRLF)
    objOutputFile.Close
    End Sub
    Set objEmail = CreateObject("CDO.Message")
    objEmail.From = "from-email-address"
    objEmail.To = "to-email-address"
    objEmail.Subject = "anything you want"
    objEmail.Textbody = "Windows Service State Report. See Attached."   ' or anything you like better
    objEmail.AddAttachment "Path to log file"
    objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-server-fqdn or IP"
    objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objEmail.Configuration.Fields.Update
    objEmail.send
    Hope this helps.
    Regards,
    Calin

Maybe you are looking for

  • How do I get rid of 'add photo' link on published photo album?

    I don't see it on my iWeb file but it shows on my published website on the photo album page: a link that says: + Add photo Any idea on how to remove that? Thanks!!

  • Problems in the installation of the Oracle 8iR2

    Hi all, Why are all of the charecters on universal installer un-readible ? The version of Oracle8i is 8.1.6. I have set up ALL the environment variables in .bsh_profile file, according to the installation guide. I use Red Hat V6.0 with CLE(Chinese La

  • How can you even out the skin tone/color from a raw photo on photoshop or bridge?

    Hello all, I am trying to figure out how to even out the skin color, I have a picture of a model, unfortunately due to light and make up and her skin color the color of her face and her hands and body dont match, I think I saw a video on youtube wher

  • Conversion inserts as picture

    I have used the program a lot with no problems.  However this morning in converting a pdf report to word, it appears the conversion treated the text as an inserted picture, which I cannot edit.  I can only adjust the formatting of the picture.  I att

  • Error con MDKExt.jar

    Hí, I am triyng to compile to application SAP MI imported from to file .WAR but when the Sap Netweaver DEveloper Studio try to compile, show me the follow error: Exception in thread "main" java.lang.NullPointerException      at com.sap.ip.me.mdk.api.