Problem in attaching PDF's in Email through Gatewayscripts

Hi,

we are facing some issue while attaching a PDF in Email. Seems no errors in the script. Script running well but i didn't receive mail with PDF attachments.

here with find the code which we are using for your reference.

1 Like

Please post formatted code, not pictures of code. That way we don't have to type it all out again to test or edit in our answers.

Hi,
Please find the formatted code.

smtp = 'Alarm_Mail'
BuildHTML = "

Test

"
subject = 'test'
body = BuildHTML
to = ['sample_mailid@gmail.com']
sender = 'TestMail@pdf.com'
html = 1

params = {'Name': 'Sample_pdf'}
a = system.report.executeReport(path = "text",project = "Project_Name", parameters = params,fileType="pdf")
attachmentNames = ['text.pdf']

attachmentData=[a]

system.net.sendEmail(smtpProfile=smtp,fromAddr=sender, subject= subject,body = body,html=html,to=to,attachmentNames=attachmentNames,attachmentData=attachmentData)

You didn't format it. Please read the linked article and then you can edit your post to fix it.

Hi,

smtp = 'Alarm_Mail'
BuildHTML = "

Test

"
subject = 'test'
body = BuildHTML
to = ['sample_mailid@gmail.com']
sender = 'TestMail@pdf.com'
html = 1

params = {'Name': 'Sample_pdf'}
a = system.report.executeReport(path = "text",project = "Project_Name", parameters = params,fileType="pdf")
attachmentNames = ['text.pdf']

attachmentData=[a]

system.net.sendEmail(smtpProfile=smtp,fromAddr=sender, subject= subject,body = body,html=html,to=to,attachmentNames=attachmentNames,attachmentData=attachmentData)
  1. Presumably Alarm_Mail is the name of an email profile you have set up on the gateway, Config → Networking → Email Settings. Is this correct?
  2. On the Email Settings profiles page there is a More ▼ button with a Test option. Did you confirm that your email profile is working?

Yes, Email settings are correct and Email profile also working. I have tested scheduled actions with the same report. only through scripting i didn't receive mail.

Hi,

Any updates???

Please let me know.