Unexpected behavior of email notifications

Hello,

I have set up email notifications using a script. They trigger using the schadule method on the gateway at specific times. Below is what it looks like:

def onScheduledEvent():
	subject = "Sample_string"
	body = 'Sample_string \n\n'
	recipients = ["x@x.com"]
	#cc_recipients = ["x@x.com"]
	smtpProfile = "EmailProfile"
	
	system.net.sendEmail(smtpProfile=smtpProfile, fromAddr="x@x.com", subject=subject, body=body, html=0, to=recipients)	

However, duplicate emails are coming into the mail I don't know what could be the reason for sending two emails instead of one. What is the cause or how can this be debugged?

Another question that comes up when sending emails is what encoding to use to send special characters such as: ą, ć, ę, ł, ń, ó, ś, ź, ż I receive in the message ąęśćżźó

Best regards,
Michał

The most common reason for this is defining the event in an inheritable project that has two leaf projects. Events should never be defined in inheritable projects for this reason.

4 Likes

Try prefixing any literal strings you are writing in Python code with the letter u. As in:
u'Some string'
Instead of
'Some string'

4 Likes

@PGriffith @pturmel Yes these are the answers to my questions! Ignition has a great community. Thank you!