Action "Send Mail Message" puts a blank line above and below my defined email message

I want to send a daily email with a Keyboard Maestro macro.

Using Action "Send Mail Message", the email in has a blank line above my message, and a blank line below my message.

That's not ideal. Is there a way to avoid those?

After a quick test on macOS 10.14, I'm not seeing the problem you report. But different versions of Mail do behave differently...

If you can let us know the macOS version you are running and also post the macro that is giving you trouble (instructions on how to do that are here) -- remembering to remove/replace any "confidential" info such as email addresses! -- I'm sure someone will be able to help.

Sorry. I meant to include that. My bad. Version 16.0 (3731.400.51.1.1)
macOS Ventura 13.2.1 (22D68)

I can't post the macro right now, since I'd have to scrub it for work. Not sure when I can post it.

Duplicate then edit to the bare minimum required to reproduce the problem -- if it is a problem with Mail (and I think it is) you should be able to do it with a single "Send Mail Message" action with a single word in the text field and everything else blank.

Thank you. To reduce variables, I also upgraded macOS just now to Ventura 13.3.1 (22E261), the latest release it offered me. Better to target "latest release" than "random version I happened to be running before". :slight_smile:

Here's my macro, and the resultant email message showing the blank line above my message and the extra blank line below the message, above my signature.

Test Macro -- 1 May 2023.kmmacros (3.4 KB)

Keyboard Maestro's Mail actions are all AppleScript under the hood, so what's happening is most probably down to the Ventura Mail app's idiosyncrasies.

On macOS 10.14.6 Mojave this is what I get from your macro (after adding the signature manually).


You can experiment for yourself using AppleScript:

# Auth: Christopher Stone
# dCre: 2015/11/01 02:32 
# dMod: 2023/05/01 23:58
# Appl: Apple Mail
# Task: Send an Email Message via Apple Mail.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @Mojave, @Send, @Email, @Message
# Test: Working with macOS 10.14.6 Mojave
# Note: AppleScripted Mail Signatures have been broken for some time...
set msgSender to "Lazarus Long <>"
set msgAddress to "Robert Heinlein <>"
set msgSubject to "\"Time Enough for Love\""
set msgBody to "Always listen to experts.
They'll tell you what can't be done, and why.
Then do it..."

tell application "Mail"
   if not running then
      delay 3
   end if
   # AppleScripted Mail Signatures are broken from (before?) Sierra through Mojave (and perhaps further).
   # set msgSignature to signature "Single-Line-Sig"
   set msg to make new outgoing message with properties {subject:msgSubject, content:msgBody, visible:true}
   tell msg
      # set its message signature to msgSignature
      set sender to msgSender
      make new to recipient at end of every to recipient with properties {address:msgAddress}
   end tell
end tell


I've commented-out the code for setting a signature, because it's broken in Mojave and perhaps beyond – but you can experiment with that as well.

Yep, seeing the same here.

As an alternative to @ccstone's excellent suggestion -- you could also clean up with keystroke actions. The downsides are that you'll need to bring Mail to the front and that manipulation via keystroke is more fragile than than using AppleScript.

Here's an example -- you'll need to set the first action to the number of paragraphs (not lines!) in your sig, and may have to change the two hard-coded "Repeat" actions to match your Mail interface (eg if you have more toolbar buttons than me, or always show the BCC field):

New Mail, Stripping Extra Lines.kmmacros (9.2 KB)


1 Like

Thank you.

1 Like

Thank you.

I'm just going to leave this as-is for now. Perhaps forever.

1 Like

I tested this in Drafts and using Shortcuts. The problem does not occur when using a Drafts Mail action. It does occur when generating an email in Shortcuts - at least when using Apple Mail's shortcut options.


That's hopeful. Thank you, @bjb.