Applescript to send an email with signature - applescript

I am trying to send an email using Apple script. Everything works fine even email is sent to the address used in the script. My problem is I am unable to add the signature in the email content. Here is the code
tell application "Mail"
set theSubject to "Subject if the testing email" -- the subject
set theContent to "Body of the email goes here" -- the content
set theAddress to "test123#gmail.com" -- the receiver address
set theSignatureName to "Charu" -- the signature name
set msg to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}
set message signature of msg to signature theSignatureName
send msg
end tell
When I try to run this I receive an error alert that says Mail got an error: AppleEvent handler failed.
I am not sure how to set the signature.
Thanks in advance

Looking back on previous threads (like this one), it seems that, with High Sierra and above, adding a signature using message signature does not work anymore. Your best bet is to just append your signature to theContent.

Related

We had some trouble connecting error when submitting slack dialog (Slack API)

I am building a slack app connected with a Symfony application that uses slash commands and dialogs as UI to create new users, accounts and projects and store them in a database.
I use a slash command to trigger a dialog with input fields and store the submitted data in a database, send a 'user successfully created' message to slack as well as a 200 response with an empty body, as described in the documentation.
However, when I fill in the input fields and press submit, I receive an error message with 'We had some trouble connecting. Try again?'. This error also prevents the dialog from closing.
The submitted data is still received correctly by my application and stored to the database and the 'user successfully created'-message is also send correctly to slack. So the whole process seems to work correctly, the only problem is that the dialog doesn't close and shows the error message.
I also tried to immediately send a http 200 response, without processing the submitted data first and this gives the same error message.
In Golang, the only thing that worked was responding with status 200 and empty body:
w.Write(nil).
I am not sure which lang are you using but try responding with an empty body.
Responding with 204 did not work for me.

Error when I send email SparkPost

First the "email send" works fine but now It doesn't work anymore and when I print the error this is the text:
ERRORE {"name":"SparkPostError","errors":[{"message":"Message generation rejected","description":"Exceed Sending Limit (sandbox)","code":"1902"}],"statusCode":400}
Anyone can explein me how I'm wroing?
This error says that you have reached the limit of messages sent from sparkpostbox.com and now must register your own sending domain. You can read about how to do that here.
Each new SparkPost account may send a fixed number of messages addressed 'From:' sparkpostbox.com. After that, the idea is that you register your own sending domain and send from that instead.
The sandbox options allows you to send using the #sparkpostbox.com domain. It is currently limited to 50 sends for the lifetime of the account. At this time you should have a verified sending domain to use going forward. If you are looking for information on testing using SparkPost, take a look at this support document: https://support.sparkpost.com/customer/portal/articles/2361300
Source of the answer for your question is there: Error "Fatal SparkPostError: Exceed Sending Limit" when sandbox=true

How to get pony to set proper envelope sender?

I'm using Ruby with Pony to send email. I can't seem to get the envelope sender to be changed to what I want; something in Pony or the code underneath it always substitutes the user_name parameter.
Any suggestions for this? I can get a text name like "Network Ops" in front of the email address by using the header parameter, but the actual email address is still incorrect.
Any suggestions?
Never mind -- it is the Gmail SMTP daemon rewriting the sender envelope. I tested against another (Qmail) server and this didn't happen.
Pony is great!

VBScript to send email without running Outlook

I have written an automated test that runs each night, and I would like to email the results each night once the test is finished.
In order to do this I attempted to put the following at the end of my batchfile:
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = "a#a.com"
.Subject = "Subject"
.ReadReceiptRequested = False
.HTMLBody = "resport"
End With
MyItem.Send
However, this is causing the email to not send because my Outlook is not open, as the test is run in the background, and I have no access to the UI.
Is there anyway to send this email without actually running outlook on the machine.
Thanks!
You can send email without Outlook in VBScript using the CDO.Message object. You will need to know the address of your SMTP server to use this:
Set MyEmail=CreateObject("CDO.Message")
MyEmail.Subject="Subject"
MyEmail.From="name#domain.com"
MyEmail.To="a#a.com"
MyEmail.TextBody="Testing one two three."
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'SMTP Server
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'SMTP Port
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
MyEmail.Configuration.Fields.Update
MyEmail.Send
set MyEmail=nothing
If your SMTP server requires a username and password then paste these lines in above the MyEmail.Configuration.Fields.Update line:
'SMTP Auth (For Windows Auth set this to 2)
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
'Username
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")="username"
'Password
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")="password"
More information on using CDO to send email with VBScript can be found on the link below:
http://www.paulsadowski.com/wsh/cdo.htm
Yes. Blat or any other self contained SMTP mailer. Blat is a fairly full featured SMTP client that runs from command line
Blat is here

Ruby send mail with smtp

I'm trying to send simple email via Ruby (no rails) on OS X, with XCode (which installs Ruby.) But I'm running into a problem with my smtp server which requires the email client to check mail before sending as a form of authentication.
How can I get Ruby to authenticate with the smtp server in a "POP" fashion before I can send mail? Not download mail; I only want to send html formatted email (eventually via Applescript calling Ruby, because Applescript doesn't support smtp), but the server requires that I check mail before I send.
Edit 4/05/10:
Well, that's embarrasing. Turned out to be simpler; I was trying to make it more complex than it needed to be. Even though my mail server requires pop before smtp, this sends OK:
require 'net/smtp'
message = <<MESSAGE_END
From: Private Person <me#fromdomain.com>
To: A Test User <test#todomain.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
Net::SMTP.start('mail.mydomain.com', 25) do |smtp|
smtp.send_message message,
'mark#mydomain.com',
'mark#mydomain.com'
end
Edit 4/04/10:
With this I get a 500 unrecognized command error; the pop server is responding, though.
require 'net/smtp'
require 'net/pop'
message = <<MESSAGE_END
From: Private Person <me#fromdomain.com>
To: A Test User <test#todomain.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
Net::POP3.start('mail.mydomain.com', 110, 'mark#mydomain.com', 'password') do |pop|
// If this line is included,
// I get a printout of the number
// of emails on the server
// right before the error:
//
// puts pop.n_mails end
Net::SMTP.start('mail.markratledge.com',
25,
'localhost',
'mark#mydomain.com', 'password', :plain) do |smtp|
smtp.send_message message, 'mark#mydomain.com',
'mark#mydomain.com'
end
end
POP before SMTP isn't one of the authentication types supported by Net::SMTP so I think you're going to have to use Net::POP3 to do your POP3 login e.g.
require 'net/pop'
pop = Net::POP3.start(addr, port, account, password)
pop.finish
Net::POP3 is in the Standard Library so should be available anywhere that Net::SMTP is.
If that doesn't make your server happy then Net::Telnet will let you send the raw commands yourself.

Resources