SendEmail used with Apple Mail hangs Mail

I was successfully using SendEmail with Apple Mail but lately Apple Mail has been getting hung up after it opens a new message window too high on the screen getting stuck under the menu bar. I then have to Force Quit Apple Mail to resolve the problem.

I am using macOS Catalina and I’m pretty clear that this has nothing to do with Panorama but rather using Mail via AppleScript is probably the issue. But as I only use Mail via AppleScript here, I thought others might experience the same issue and might have found a workaround.

I’m still using High Sierra, so I can’t duplicate your problem, but your description sounds interesting. One of the properties of a new outgoing message is the visible property, which has always defaulted to false. From your description, it sounds like it is now defaulting to true.

If my guess is correct, it may be possible to fix the problem by changing the line which reads

set newMessage to make new outgoing message with properties {subject:”+applescriptstring(eSubject)+“, content:”+applescriptstring(eBody)+“}


set newMessage to make new outgoing message with properties {visible:false, subject:”+applescriptstring(eSubject)+“, content:”+applescriptstring(eBody)+“}

This line is in the SendEmail procedure in the Email_Apple Mail.pandb database in the Channels folder, in the Resources folder, in the Contents folder of the PanoramaX application bundle.

I’m regularly entertained by your significant level of success on diagnosing these things. Unfortunately, I am not figuring out how to open the .pandb file. I’ve drilled down to find it, but I’ve not come up with a method to open the file. It is not opening like most other Panorama files.

FWIW, my original issue is one where apps typically open subsequent windows offset by some small amount so that they do not open on top of the previous window. Mail though lately has been opening the windows higher and higher until they are under the menu bar. I’ve come up with a semi solution in that before I run the procedure that has the SendEmail in it, I create a new message. I then make that window much smaller than normal, and move it down towards the bottom of the screen. This sometimes causes the next window to open lower than it might typically, which can sometimes give me enough clearance that Mail does not fail when sending a high number (+20) emails. It kind of works, but not always.

Ok. Back to why doesn’t Email_Apple Mail.pandb open like a regular Pano file? I’ve tried double clicking, File / Open, Control click Open.

Still guessing, because I opened mine with a double click. It may be that your file was already open in secret. When I opened mine, Panorama wasn’t running. It launched when I double clicked on the file.

Hmm. Ok. I originally tried to open that file while another Pano file was open. No luck.
Then I closed that file, and had no file open. Again tried to open it multiple ways. No luck.
But as you did, I quit Pano, and a double click opened the file with the 3 procedures ready to edit.

Anywho, adding your visible:false parameter may have done the trick. There was in fact something that was happening in Mail but the extremely rapid flashing of what seemed to be a new document came and went so quickly that it was not really clear what it was, so while it was not invisible, it did seem to solve the problem. I sent 50 emails and Mail did not hang while it would most often hang within 10 emails if I did not set it up with my workaround.

Thanks again Dave for your interest and solution.

This is almost certainly what happened as far as that goes. In that case, you should be able to open a visible window using the View Organizer. The pop-up menu will list all databases, including channel modules (I just verified this). Then you can select Procedures and click on whatever procedure you want to open it.