Error sending email , expected MIME Type, got Null?

Using 7.9.23. Trying to send a report with the following script -

def sendReport(endDateDT=None):
    How will we determine what counts as marked?  should marked really be a datetime?  Perhaps.  Or based on when the entry was entered?
    An old entry from months ago that gets marked this week - should that be sent for instance.
    """"Trying to send report")
    if endDateDT is None:
        endDateDT ="Using date %s"%(str(endDateDT)))
    reportName = 'DPD Weeklies Projects Updates'
    action = 'email'
    reportParameters = {'endDate':endDateDT}
    endDate =, 'yyyy-MM-dd')
    project = 'DPDWeeklies'
    body = "Cooleagues,\n\nBelow are the project updates for the week.\n\nPlease feel free to reach out if you have any questions regarding the updates.\n\nThanks"
    actionSettings = {'to':[''], 'smtpServerName':'Weekly Hot Topics Mailer', 'from':'', 'subject':'DPD Weeklies w/e %s'%(endDate),"body":body}
    reportData =, project=project, parameters=reportParameters, fileType='pdf')
    fileName = 'DPD Weeklies Updates %s'%(str(endDate))
    print fileName
    print type(reportData)'Weekly Hot Topics Mailer', fromAddr='', subject='DPD Weeklies w/e %s'%(endDate), body=body, to=[''], attachmentNames=[fileName], attachmentData=[reportData])
#, project=project, parameters=reportParameters, action=action, actionSettings=actionSettings)"Finished trying to send report")

I am getting an error on the part the error and not sure why. Apologies for screen shot, operator is remoted in a few layers deep and cannot copy paste for some reason -

My sendEmail line does work if I leave off the attachmentNames and attachmentData kwargs, so I hting that is the issue but I don't know why. My print statements shows the filename to be DPD Weeklies Updates 2023-08-18 and the type of reportData as <type 'array.array'>. Any ideas what is going on?

Good news; we already fixed the underlying limitation here and made it more flexible.
Bad news: it's fixed in 8.1.22 and up.

See this thread for more context:

And more details on how it works are in

1 Like

Ah. Ok. Unfortunately this customer has no impending plans to upgrade to 8.1.xx or pay for the 8 license in the forseeable future but luckily Phil linked so I will have to give it the old college try myself.

I got this working without any using java libraries or upgrading.

Changing this -
fileName = 'DPD Weeklies Updates %s'%(str(endDate))
fileName = 'DPD Weeklies Updates %s.pdf'%(str(endDate))
made everything work correctly.