GoAnywhere
  • Contact Us
  • Login
  • Live Chat
  • Free Trial
  • Support
  • Company
Request Demo
GoAnywhere
MENU
  • Solutions
    • Managed File Transfer
    • Cloud File Transfer
    • Secure FTP
    • AS2 Transfers
    • OpenPGP
    • Sharing & Collaboration
    • Agents
  • Industries
    • Banking & Finance
    • Healthcare
    • Higher Education
    • Insurance
    • IT & Telecom
    • Logistics
    • Manufacturing
    • Media & Entertainment
    • Public Sector
    • Retail
  • Platforms
    • Windows
    • VMware
    • Linux
    • Amazon EC2
    • Azure
    • IBM i (iSeries)
    • AIX and UNIX
    • Mac OS
  • Products
    • GoAnywhere MFT
    • GoAnywhere Gateway
    • Free FTP Client
    • Free FTP Server
    • Free Collaboration
    • Free OpenPGP Encryption
  • Resources
    • Brochures
    • Case Studies
    • Compliance
    • Testimonials
    • Video Library
    • Video Reviews
    • Webinars
    • White Paper Library
  • Blog
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Register
  • Login
  • Board index
  • GoAnywhere Director
  • Community Forum

Use a query to generate "to:" email list?

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts Page 1 of 1
  • Print view
 Post a reply  

Use a query to generate "to:" email list?

ericbird
Verified User
 
Posts: 2
Joined: Mon Aug 17, 2009 9:54 am
by ericbird » Mon Aug 17, 2009 9:57 am
Reply with quote
I'd like to run a SQL query, and then use the results of the query as the list of addresses to send an email to. For instance, the output of the query might be something like:

name1@fakecompany.com
name2@fakecompany.com
name3@fakecompany.com

which i can feed into a rowset variable. Can I then use this rowset variable to send a message to all of these people? If so, how?

Thanks a lot.

Eric

Re: Use a query to generate "to:" email list?

Support_Julie
Support Specialist
 
Posts: 80
Joined: Thu Mar 05, 2009 3:49 pm
Location: Ashland, NE USA
  • Website
by Support_Julie » Mon Aug 17, 2009 2:52 pm
Reply with quote
In the following project, the MYLIB.MYFILE file contains one field. Each record contains an email address.

First, query the database to find the email records you need.

Next, write that rowset to a CSV file.

Use the Search and Replace Task to replace the end of record value (which by default is CRLF) with a comma.

Now, load the data from the new CSV file to a variable using the “Set Variable” task.

This variable is used in the “TO” field of your Send Email task.

Code: Select all
<project name="Email Test" mainModule="Main" version="1.0">
   <module name="Main">

      <createWorkspace />

      <sql resourceId="MyDatabase">
         <query outputVariable="data">
            <statement>Select * from MYLIB.MYFILE</statement>
         </query>
      </sql>

      <writeCSV inputRowSetVariable="${data}" outputFile="data.csv" whenFileExists="overwrite" outputFileVariable="dataout">
         <data trim="both" />
      </writeCSV>

      <searchAndReplace inputFile="${dataout}" outputFile="dataout2.csv" searchFor="\r\n" replaceWith="," whenFileExists="overwrite" outputFilesVariable="dataout2" />

      <setVariable name="toAEmailList" inputFile="${dataout2}" />

      <sendEmail resourceId="My SMTP Server" toList="${toEmailList}">
         <from address="me@mycompany.com" />
         <subject>
            <![CDATA[this is a test]]>
         </subject>
      </sendEmail>
<deleteWorkspace />


   </module>
</project>

 Post a reply  
2 posts Page 1 of 1
  • Print view
Return to “Community Forum”
  • GoAnywhere MFT
  •    ↳  Knowledge Center
  •    ↳  Community Forum
  • GoAnywhere Director
  •    ↳  Knowledge Center
  •       ↳  Example Projects
  •    ↳  Community Forum
  • GoAnywhere Services
  •    ↳  Knowledge Center
  •    ↳  Community Forum
  • GoAnywhere OpenPGP Studio

Who is online

Users browsing this forum: No registered users and 0 guests
  • Board index
  • All times are UTC-05:00
 

 


Login


Company

  • About Us
  • Blog
  • Certifications & Partnerships
  • Upcoming Events
  • News
  • Our Customers
  • Testimonials
  • Awards & Recognition

Products

  • GoAnywhere MFT
  • GoAnywhere Gateway

Resources

  • Brochures & Data Sheets
  • Case Studies
  • Compliance
  • Testimonials
  • Videos
  • Video Reviews
  • Webinars
  • White Papers

Compliance

  • PCI
  • HIPAA
  • GDPR
  • FISMA

Industries

  • Banking and Finance
  • Healthcare
  • Higher Education
  • Insurance
  • IT & Telecom
  • Media & Entertainment
  • Logistics
  • Manufacturing
  • Public Sector
  • Retail

Partners

  • Join Our Partner Program
  • Partner Login

Support

  • Overview
  • Contact Us
  • Customer Login
  • Downloads
  • FAQ
  • Live Chat
  • Release Notes
  • Support Forum
  • Register for Training

How to Buy

  • Request a Quote
  • Find a Local Reseller
  • Referral Program

Notices

  • Copyright Notice
  • Privacy Notice
HelpSystems

1-800-949-4696 | goanywhere.sales@helpsystems.com | Privacy Policy
Copyright © 2008 - 2018 HelpSystems. GoAnywhere® is a registered trademark of HelpSystems.

Blog LinkedIn Twitter Facebook YouTube
  • Solutions
    • Managed File Transfer
    • Cloud File Transfer
    • Secure FTP
    • AS2 Transfers
    • OpenPGP
    • Sharing & Collaboration
    • Agents
  • Industries
    • Banking & Finance
    • Healthcare
    • Higher Education
    • Insurance
    • IT & Telecom
    • Logistics
    • Manufacturing
    • Media & Entertainment
    • Public Sector
    • Retail
  • Platforms
    • Windows
    • VMware
    • Linux
    • Amazon EC2
    • Azure
    • IBM i (iSeries)
    • AIX and UNIX
    • Mac OS
  • Products
    • GoAnywhere MFT
      • Administration
      • Connectivity
        • Amazon S3 Bucket
        • AS2
        • Database
        • FTP
        • FTPS
        • GoFast
        • HTTP(S)
        • ICAP
        • Mail Servers
        • Message Queue (MQ)
        • Native Calls
        • Network Shares
        • SCP
        • SFTP
        • SMS
        • SNMP
        • WebDAV
      • File Servers
        • AS2
        • FTP
        • FTPS
        • HTTPS
        • SFTP
        • GoFast
      • Encryption
        • FIPS 140-2
        • Encrypted Folders
        • Open PGP
        • Open PGP for IBM i
        • GnuPG (GPG)
        • SSH
        • SSL/TLS
        • Zip with AES
        • Key Management
      • Agents
      • Translation
        • Delimited Text
        • Excel
        • Fixed Width Text
        • XML
      • Workflows
        • Resources
        • Tasks
      • Automation
        • Scheduler
        • File Monitoring
        • Commands and APIs
        • Triggers
      • Collaboration
        • GoDrive
        • Mobile Apps
        • Secure Mail
        • Secure Forms
        • Secure Folders
      • Auditing and Reporting
        • Auditing
        • Reporting
      • Clustering
      • Learn More
        • Detailed Features
        • Security
        • FAQs
        • Installation Requirements
        • Tutorials
          • Getting Started with GoAnywhere MFT
          • Getting Started with File Transfer Services
          • Getting Started with Projects
          • Automating Project Workflows
          • How to Encrypt Files with Open PGP
          • How to Import a CSV File into a Database
          • Getting Started with Domains
          • Converting Scripts to Projects
          • How to Read JSON Data and Insert it into a Database
          • How to Query a Database and Write the Data to JSON
          • Using the SQL Wizard to Join Data from Two Database Tables
          • How to Enable SSL for HTTPS/AS2 Server Connections
          • Configuring the AS2 Client to Send AS2 Messages
          • How to Configure the AS2 Service to Receive AS2 Transfers
          • Configuring Web User Accounts to Receive AS2 Messages
        • Pricing
        • Release Notes
    • GoAnywhere Gateway
      • How it Works
      • Load Balancing
      • PCI DSS Compliance
      • Installation Requirements
      • Release Notes
      • FAQs
      • Pricing
    • Free FTP Client
    • Free FTP Server
    • Free Collaboration
    • Free OpenPGP Encryption
      • Download
      • Documentation
        • Installation
          • Microsoft Windows
          • Linux and Unix
          • Mac OS X
        • Key Manager
        • Key Preferences
        • Encrypt
        • Sign
        • Encrypt and Sign
        • Decrypt and Verify
        • Verify
      • Automation
      • Support
  • Resources
    • Brochures
    • Case Studies
    • Compliance
    • Testimonials
    • Video Library
    • Video Reviews
    • Webinars
    • White Paper Library
  • Company
    • About Us
    • Blog
    • Certifications
    • Upcoming Events
    • News
    • Our Customers
    • Testimonials
  • Support
  • Request a Demo
  • Live Chat
  • Customer Login
  • Blog