Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Library -> Send Email Issues

Hey Guys,

We are having issues getting the Send Email code to work. I have been working with my IT guy and scouring the forums and we are unable to resolve the issue.  I started with the Send Email template from the library and after reading this post (https://legacy.sawtoothsoftware.com/forum/17199/library-send-email?show=17199#q17199) I modified the code as this guy suggested.  So, I am no longer getting the 132 error, but no emails are being sent.

We have tried several email servers (office365, live.com, gmail, etc.) and nothing is working.  So this is a three part question I guess.

Part 1: It looks like for this code to run something needs to be installed/set up on your servers.  Does such a thing exist (also, as we were doing some research MIME::Lite appears to be a better way to send messages so can you guys install that on your servers)?

Part 2: Assuming we get this to work, the surveys are going to be administered in person and most likely via the Offline Survey app. If we collect the data using offline surveys will the script run once the data hits the server?

Part 3: Assuming we cannot get the Perl to work, we are thinking of sending the data to a third party server where we can run a different program (e.g. Powershell).  I can't think of any reason this wont work so long as the tablets are connected to the internet, but how do your servers handle the link out / hand off if data are collected using Offline Surveys?

[% Begin Unverified Perl
use Net::SMTP;

# Parameters
my $to = GETVALUE("ConfirmEmail");
my $subject = 'Will It Blend?';
my $body = 'Please please please please work';
my $authUser = 'REDACTED';
my $authPass = 'REDACTED';

my $smtp = Net::SMTP->new('smtp.gmail.com', Port => 465);
if ($smtp) {
    $smtp -> auth($authUser, $authPass);
    $smtp -> mail($authUser);
    if ($smtp -> to ($to)) {
        $smtp -> data();
        $smtp -> datasend("To: $to\n");
        $smtp -> datasend("From: $authUser\n");
        $smtp -> datasend("Subject: $subject\n");
        $smtp -> datasend("\n");
        $smtp -> datasend("$body\n");
        $smtp -> dataend();
    }
    $smtp -> quit;
}
return 0;
End Unverified %]
asked Aug 17, 2021 by Nwiggin Bronze (1,785 points)

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.
...