• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Send outgoing message error from Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Send outgoing message error from Mail.app


  • Subject: Re: Send outgoing message error from Mail.app
  • From: Brian Christmas <email@hidden>
  • Date: Wed, 27 Jan 2010 16:16:05 +1100


On 27/01/2010, at 3:56 PM, Alan Kimelman wrote:

Brian

The outbox mailbox only appears to activate in Mail.app if an outgoing message cannot be sent. On error, an outgoing message appears to end up in Mail's outbox. Absent an error of sending, the message does not end up in the outbox mailbox, and the outbox mailbox is not visible. 

The condition that I am trying to address is sending an outgoing message that has been  formatted correctly, and that has  an address in the  "To:" field. I am attempting to run an applescript to  send a specific outgoing message,  similar to what a user might request by clicking the Send command in the Message menu of Mail. As far as I see, an unsent outgoing message is not contained by any mailbox. 

Did you have any luck in scripting a send command  of an outgoing message in such circumstances?

Alan 

Alan, if you're formatting the message automatically  in Applescript, and want to send it, it's straightforward.

This is lifted from a script I've written, and hopefully will be what you need. It also shows how to include a path to a logo which you can create and use as a header/footer in your email. If you need any part explained, let me know.


Regards

Santa

on SendABloodyTally(theLastMidnight)
set the_subject to "eMail Tally since " & year of theLastMidnight & " " & month of theLastMidnight & " " & day of theLastMidnight
set TimeAdjust to time to GMT
set Prefix to "adding "
set TimeAdjust2 to TimeAdjust
if TimeAdjust2 < 0 then
set Prefix to "subtracting "
set TimeAdjust2 to TimeAdjust * -1
end if
set TimeMessage to "Adjusted by " & Prefix & TimeAdjust2 / hours & " hours to get local time."
set TallyString to {"Computer processed data since " & theLastMidnight & "..."} & return & return & TimeMessage & return & "Hour " & return
set theLastTally to 0
repeat with x from 1 to 24
set thetemphour to item (3 + (x * 2)) of TheTally as string
set theReadingTally to item (4 + (x * 2)) of TheTally as string
set tempX to x + ((TimeAdjust / hours) div 1) - 1 as number
if tempX < 0 then set tempX to (tempX + 24)
if tempX = 0 then
set tempX to "12am" as text
else
if tempX = 12 then
set tempX to "12pm" as text
else
if tempX = 24 then
set tempX to "12am" as text
else
if tempX > 24 then
set tempX to (tempX - 24) & "am" as text
else
if tempX > 12 then
set tempX to (tempX - 12) & "pm" as text
else
set tempX to tempX & "am" as text
end if
end if
end if
end if
end if
if (count of tempX) < 4 then set tempX to "  " & tempX as text -- This counts the characters, and adds spaces if below 4
-- This builds string of asterixes for each hour
set GraphString to ""
repeat with y from 1 to theReadingTally
set GraphString to GraphString & "●"
end repeat
-- This add space if number below 10
if (count of GraphString) < 10 then set theReadingTally to "  " & theReadingTally as string
-- Build Tally string
set end of TallyString to tempX & " :" & theReadingTally & (ASCII character of 9) & GraphString & return
end repeat
set EndString to "Have a good day."
set the_content to (my SetTheHeading() & ¬
"Total Mail items processed : " & item 1 of TheTally as string) & return & return & ¬
"Since " & theLastMidnight & " (Universal time), we computer processed..." & return & return & ¬
"Total Mail for the period : " & item 2 of TheTally & return & return & ¬
the TallyString & return & return & ¬
EndString
try
set LogoPath to MailPrintingFolder & ":Logo.png"
set LogoPath to POSIX path of LogoPath
on error
set LogoPath to ""
end try
tell application "Mail"
activate
set newMessage to make new outgoing message with properties {address:MainMailRecipient, subject:the_subject, attachment:LogoPath, content:the_content}
tell newMessage
set x to offset of TheBusinessName in the_content
set font of characters x thru (x + (count of TheBusinessName)) of content to "Helvetica Bold"
set color of characters x thru (x + (count of TheBusinessName)) of content to {56342, 2442, 607}
set y to offset of "Hour " in the_content
set the size of characters (y + 5) through ((count of the_content) - (count of EndString)) to 14
repeat with x from y to ((count of the_content) - (count of EndString))
if character x of the_content = "●" then
set color of character x of content to {56342, 2442, 607}
end if
end repeat
make new attachment with properties {file name:LogoPath} at before the first paragraph
--make new to recipient with properties {address:MainMailRecipient}
repeat with themailitem in MainMailRecipient
make new to recipient at end of to recipients with properties {address:themailitem}
end repeat
repeat with themailitem in ReportCCRecepients
make new cc recipient at end of cc recipients with properties {address:themailitem}
end repeat
send
end tell
end tell
end SendABloodyTally
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Send outgoing message error from Mail.app
      • From: Alan Kimelman <email@hidden>
References: 
 >Fwd: Send outgoing message error from Mail.app (From: Alan Kimelman <email@hidden>)
 >Re: Send outgoing message error from Mail.app (From: Brian Christmas <email@hidden>)
 >Re: Send outgoing message error from Mail.app (From: Alan Kimelman <email@hidden>)

  • Prev by Date: Re: Send outgoing message error from Mail.app
  • Next by Date: Re: Send outgoing message error from Mail.app
  • Previous by thread: Re: Send outgoing message error from Mail.app
  • Next by thread: Re: Send outgoing message error from Mail.app
  • Index(es):
    • Date
    • Thread