File to Send Email from PanX is Available

Sometime ago, I claimed I’d try to put together a black box for email via Panorama X and Python. I’ve finally gotten it done. This would have been posted to the Database Exchange but there are two small files included, not one, so it isn’t accepted.

Download Mailbox, a utility database for use with Panorama X and Python 2.7 or later for sending email from Panorama X. OS X systems come with Python pre-installed, so typically there is no need to even concern yourself about it. Mailbox will just run.

Mailbox greatly simplifies the task of sending email directly from your Panorama databases and requires very little Panorama programming on your part. And while it can be used as-is, ideally you’ll use it as a starting point to build your own emailing system. See the built in help system for details.

Mailbox can send plain text email or HTML styled email. It can include embedded images or attached files. It can be used along with a Panorama database to perform data merges to send a single email message at a time or to loop through as many as you choose.

Although it’s delivered in a locked-down mode, access is freely provided on request.

1 Like

The Database Exchange does allow for uploading multiple files in a folder. Check out the special instructions at the bottom of the Uploading to the Panorama Exchange page.

Right you are Gary. Thanks, I did overtook that. It still required several tries after the validation worked because the Upload button remained disabled. Eventually I got the routine where the window close, then re-opened immediately with Upload enabled.

James, this is the simplest technique I’ve been able to come up with. It looks ridiculous but it works:

  1. Open the upload form and click in one of the uploaded databases in the left sidebar.
  2. Select Share>Add Database …
  3. Fill in the data boxes. DO NOT press Validate.
  4. Open or click in a Panorama X database, go to a procedure, remove and replace a character and save.
  5. Return to the upload window, click on Validate, then click on Close.

I have found that, without fail, the window closes and re-opens with the Upload button available.

Also, my recollection is that, if you have multiple files, the zip file must NOT have the same name as the Panorama X file.

Thank you Jim, this file is now available from the Panorama Database Exchange.

Mailbox provides for another way to send emails from Panorama X. One of the extended capabilities is its ability to send HTML formatted stylized text. Great.

The next hurdle was how to easily create the HTML text with readily available tools. My first thought was to use a 'Text Display Object but that used Rich Text. Then I thought to use Apple’s Mail program as it could easily create the colored, bolded, italiziced, variable font size text but alas while readily available, it wasn’t creating HTML.

What would be an easy path to allow a user to create HTML so that I could then capture that and use it for their emails? Something as easy as Mail, but with HTML that could be grabbed into a variable?

I have found this Online HTML Editor. Is there something others use or am I missing something that might allow all of this to be done within Panorama?

TextEdit gives you the option of saving as a web page. From there, fileload( can import the html source code.

1 Like

There is no WYSYWIG HTML tool in Panorama.

I tend to hand code HTML, HTML was not designed for WYSYWIG and tools that do this can generate some convoluted, bloated HTML code. That said, the Online HTML Editor you found looks pretty functional.

However, I will caution you that using HTML for email is a minefield. Email clients mostly support only a subset of HTML, and it’s different for each client. It’s kind of like going back to 1997 in terms of web standards. If you’re going to do anything beyond just bold, italic and links then you need to do a lot of research and testing. For example, CSS is completely out for most email clients.

There’s actually no need to get terribly involved with the HTML. You can do a lot using just simple tags - on the other hand, you can build a very complex page in DreamWeaver or another HTML editor and save it as a template.

The degree to which you style the message is entirely up to you but there is a lot you can do while keeping it simple.

I do a lot of direct email marketing for my photography and send a few hundred styled emails at a time. I’ve modified my copy of Composer to merge some data from my Contacts file and to loop through the selected names to send an email blast.

I’ve also got a procedure that converts line breaks to create opening and closing paragraph tags along with some other common items. You can invent your own tags to enter into the text then have a procedure change them to proper html tags too.

I send a file that looks like this via the Composer file included with the Python Mailbox:

<!DOCTYPE html>
<html lang="en">
<body link="blue" vlink="blue" bgcolor="#f2f2f2"> 
<font style="font-style: normal; font-size: 16px;" face="Optima" >
<blockquote>
<p>
Hi «Salutation»,
</p>
<p>This is <b>not</b> an appealing photograph.
</p>
<div align="center">
<img src="images/michigan/LakeinWinter/DSC05558.jpg"/><br />The Lake in Winter</div>
<p>
It was created on January 29, 2021 when Lake Michigan should have had a thick coat of ice stretching well beyond the shoreline towards the horizon. But in this winter, records were being set for lack of cold and snow - including a record low of 1.8% ice coverage on the Great Lakes which are normally at about 20% by the end of January.
</p><p>
The lakes are complex geophysical environments with many life forms dependent on them and their normal rhythms of seasonal temperatures. Lack of ice, for instance, diminishes the successful growth of diatoms that feed zooplankton that feed small fish that feed bigger fish and so on.
</p><p>
I've posted a slideshow, <a href="https://jamescook.biz/galleries/WestMichiganGallery.php#flr">The Lake in Winter</a>, a 14 year documentary of Lake Michigan at Oval Beach, consisting of images created during the same period of time in winter. It's interesting to see how this same view of the lake has compared over the years.
</p>
</div>

My best to you!
</br>
James Cook
</p><p>

Email: <a href = "mailto:Jim@JamesCook.biz">Jim@JamesCook.biz</a> <br />
Link to any of my web sites via: <a href = "http://saugatuckphotography.com">SaugatuckPhotography.com</a>  <br />

Represented in Saugatuck by <a href="http://www.goodgoods.com">GoodGoods</a>
</p><p>

<font size="-1">If you wish you can safely <a href="mailto:admin@saugatuckphotography?subject=Opt%20Out&amp;body=Remove me from your email lists">click here</a> to opt out of our email list. Or reply to this message with any minimal wording to let me know your desires and we will promptly eliminate you from our list of recipients.</font></font>
</p>
</blockquote>
</body>
</html>

It results in an email that looks like this:

Hi James,

Can your python solution run on Panorama X Server?

Also, I see there has been some discussion about html WYSYWIG. Here is a screen grab of how I am coding html with a preview in Panorama. It is a field with the html and a web browser object. Maybe it will help some one.

Absolutely, I’ve got variations working on the servers of several clients running on Enterprise 6 now. There’s no reason Pan X Server should treat it any differently.

It’s just a matter of calling it with the variables noted in its built in help. Or, crack it open and write your own connections.

An updated version of the Python Mailbox has been posted in the Database Exchange. It has been revised to recognize and respond to the version of Python installed on the computer. It has been tested on a few versions of Python ranging from 2.7 to 3.10.4.

Apple no longer includes Python in the OS installation so it’s up to you to install it. Panorama X also now includes the ability to utilize the installed version.

Personally, I use Mailbox to send promotional email regarding my photography to an established list of a few hundred. All are personalized with a “Dear WhatsYourName” and anything else I decide to merge into the message. It took less than five minutes to send 250 last night; my daily limit with the ISP.

FWIW, here’s the script I added to the Composer file included in the download that interfaces with my Contacts file:

FileGlobal fgList, fgErrors
fgList = “”
fgErrors = “”
Let lvSuccess = “”
LetFileGlobal fgResult = “”

ArraySelectedBuild fgList,¶,“Contacts”,recID

AlertokCancel “You have “+pattern(arraysize(fgList,¶),”#,”)
+" selected to receive this email."
if info(“dialogtrigger”) = “Cancel”
stop
endif

Let lvNow = “”

Loop
lvNow = arrayfirst(fgList,¶)
fgList = arrayrange(fgList,2,arraysize(fgList,¶),¶)
To = arrayfirst(lftocr(lookup(“Contacts”,recID,lvNow,«Email Addresses»)),¶)
If To = “”
fgErrors = strip(fgErrors+¶+lvNow)
Else
Salutation = lookup(“Contacts”,recID,lvNow,Salutation)
Call .Email
EndIf
If fgResult[1,4] = “No E”
lvSuccess = strip(lvSuccess+¶+lvNow)
EndIf
Until fgList = “”

If lvSuccess ≠ “”
Let lvMemo = datepattern(today(),“mm/dd/yy”)+" - “+Subject
gettextokcancel “Add a Mailing memo?”,lvMemo
if info(“dialogtrigger”) = “Cancel”
stop
endif
OpenFile “Contacts”
Field Mailings
FormulaFill ?(arraycontains(lvSuccess,recID,¶) = -1,lvMemo+sandwich(” • “,Mailings,”"),Mailings)

EndIf

The script was written some time ago and could easily be converted to use a number of other Panorama features, such as LoopArray. I offer it here simply as an illustration of a way that the Mailbox and Composer can work for you by tying them to your own databases and processes for single or multiple messages.

I’ve posted a new version of Mailbox to the Database Exchange. This version has better backward compatibility with Python 2.7 which enabled enhanced handling of email attachments for use with later versions of Python and has been tested on the most recent Python 3.12.

Although Python is no longer included in recent Mac OS installations, downloading and installing Python is now easy and straightforward.

Included is a greatly enhanced Composer file that can be linked to your own databases for easy creation of sending of email to one or many at a time.

Access to forms and procedures is included in both files along with built-in Help.

As noted in the Database Exchange:

Mailbox 3 is a Panorama utility file built for sending email directly from other Panorama X databases using Python 2.7 or later. At this writing Python 3.12 is current. Prior to Mac OS 12.3.1, Python was included in the OS installation. Later versions of the Mac OS require user installation. Fortunately, downloading and installing Python is easy. See Python Downloads and Scripting Language Configuration for the simple steps of activating Python for use with Panorama.

Once it's configured to your email account, Mailbox greatly simplifies the task of sending email directly from your Panorama databases and requires very little Panorama programming on your part. And while it can be used as-is, ideally you'll use it as a starting point to build your own emailing system. It has built in help for details.

Mailbox can send plain text email or HTML styled email. It can include embedded images and/or attached files. It can be used along with a Panorama database to perform data merges to send a single email message at a time or to loop through as many as you choose.

Mailbox is also useful on a Panorama server. (Or its extracted Python script.) Shared or web enabled databases can send email from the server, such as responses to queries, scheduled reminders or alerts that an event has occurred on the server. For instance, on a medical site, Panorama server can monitor appointments and create an ICS file and include it in an emailed reminder of an upcoming appointment.

Although it's delivered in a locked-down mode, complete access is built in.

Composer is an optional accessory to Mailbox. Without further action, it can be used to compose and send email from Panorama via Mailbox. The real benefit of Composer is in that it has tools to help you connect it to your contacts type of database from which it can link to email addresses and other data related to the people in that database.

Beyond the simple insertion of an email address or name, Composer can make full use of Panorama's datamerge capabilities enabling the creation of extremely personalized messages.

 

Composer includes tools to automate much of the work required to assemble styled HTML messages. It makes it easy to save and re-use message templates. You can also create and save a signature block, a formatted logo, footnote/disclaimer or even your own customized CSS styling beyond what's provided, if you wish to use it at all.

Composer is delivered with access to all forms and procedures so that you can use it as-is, make modifications to fit your needs, or cannibalize it to build your own emailer.

1 Like

Wow! Thank you Jim. That still doesn’t mean … you know. :slightly_smiling_face:

The last link leads to a #404 error page. The link should read
Scripting Language Configuration

Thanks. The link is fixed