Forum Discussion

hina_walia's avatar
hina_walia
New Contributor
6 years ago

Load sql query data to csv file and send this file in email as an attachment

Load sql query data to csv file and send this file in email as an attachment. I tried using snowflake execute snap to get sql data and then use csv parser and write to file writer.The data is not shown in file writer. Can you help me on solving this issue and then how to send the csv file in attachment. Thanks

6 Replies

  • are you getting an error?, you have to write the file in sldb, also I believe the attachment size should be less than 25 MB, after your file writer snap use an email sender snap and set the attachment property to $filename, This should work fine.
    file writer output :
    email sender:

    Regards
    Anubhav

  • hina_walia's avatar
    hina_walia
    New Contributor

    Please see attached, (i have 2 issues- csv file not generated and file not sent in email).I am not able to send data of sql to csv file.Please see attached

    • anubhav_nautiya's avatar
      anubhav_nautiya
      Contributor

      Do you get any data when you validate the pipeline? or you dont get the output in validation too

      • hina_walia's avatar
        hina_walia
        New Contributor

        I am getting cannot connect to email server, though same server works in another application tool for sending email. Can this be a access issue?
        Reason:

        Failed to send email message: Could not connect to SMTP host: xxx, port: 25

        Hide Details…

        Email Sender[58b7a2f5ba6d563aff5d73d9_6dded5c7-fe3c-4525-a1b1-2640e8cf9562 – d3383eb5-462b-4d09-b45e-beb2f059f42e]
        com.snaplogic.snap.api.SnapDataException: Failed to send email message

        at com.snaplogic.snaps.email.EmailSender.writeErrorView(EmailSender.java:629

  • SpiroTaleski's avatar
    SpiroTaleski
    Valued Contributor

    Hi @hina_walia,

    It’s looks like an connection issue. Can you please check if the properties of the SMTP email account configuration(password, port, Server domain, Secure connection) in SnapLogic are correct?

    Regards,
    Spiro

    • hina_walia's avatar
      hina_walia
      New Contributor

      yes i will check and get back to you. Thanks in advance.