dylinn has asked for the wisdom of the Perl Monks concerning the following question:

It looks like me trying to keep it short and sweet is not working. I'm now going to post everything that I know about this situation. I hope it is not too long / against the rules.

This is the ReadMe Text that I received. The changes indicated have been made, but as you can see it does not address needing authentication:

GENERIC PERL SCRIPT =================== This script is designed to run on any server which has access to a SMTP server and is running a Perl interpreter. It uses a socket connection directly to the mail server so has no need for a command line mailer. INSTALLING AND CONFIGURING THE SCRIPT ====================================== * Install and test the Perl interpreter as described in the documentation for your Perl interpreter. * Open up the script subques.pl in a text editor such as notepad or vim * Check the port that the SMTP server runs on. This is usually port 25. If it is different change the line $port = 25; at line 3. * Find the line $smtpServer = 'MAIL_SERVER_ADDRESS'; at line 4, * Replace the text MAIL_SERVER_ADDRESS with the address of the SMTP server you wish to use. * Find the line $domain = 'DOMAIN_RESPONSES_APPEAR_FROM'; at line 5, * Replace the text DOMAIN_NAME_RESPONSES_APPEAR_FROM with the domain of your server. Responses will appear to be from surveyScript@DOMAIN_NAME * Find the line $sWebMaster='CONTACT_ADDRESS_FOR_ERRORS'; at line 6, * Replace the text CONTACT_ADDRESS_FOR_ERRORS with an email address for problems with the survey to be sent to. * Find the line $sReturnURL='URL_LINK_FROM_SCRIPT_PAGES'; at line 7, * Replace the text URL_LINK_FROM_SCRIPT_PAGES with the full URL of the page respondents should go to after a successful submission. * Find the line $sReturnText='TEXT_FOR_LINK_FROM_SCRIPT_PAGES'; as line 8, * Replace the text TEXT_FOR_LINK_FROM_SCRIPT_PAGES with the text the respondent will click on to move on after a successful submission (to go to the URL you specified as 'URL_LINK_FROM_SCRIPT_PAGES' above. * Check that the line #!/usr/local/bin/perl at the top of the file points to the path of your Perl interpreter. * Set permissions on the script to be read and execute

Replies are listed 'Best First'.
Re: Authenticate email
by MidLifeXis (Monsignor) on Mar 04, 2015 at 17:15 UTC

    The error No unauthenticated relaying permitted. sounds like a message from the email server being used to send the mail. It is probably configured to require you to authenticate before use.

    --MidLifeXis

      Thanks for those links, I had not found them in my searches. Also, sorry for the lack of needed information. I'm flying blind here and was trying to keep it short. : )

      IPowerWeb is my host. They say the Net/SMTP.pm module is already installed. I have included the part of the script I was instructed to modify with my information, which is done. I believe I just need to add the code to point to / use the Net/SMTP.pm module. Or would I need to edit the Module as well??

      #!/usr/bin/perl #First released with snap 10 $port = 25; #SMTP PORT NUMBER $smtpServer = 'smtp.ipower.com'; $domain = 'mydoman.biz'; $sWebMaster='survey@mydomain.biz'; $sReturnURL='http://mydomain.biz'; $sReturnText='Submit';

        Or would I need to edit the Module as well?

        No need to edit the module.

        The snippet of code shows some variable declaration.

        What it does not declare is the username and password declaration that would be needed for authentication. (never post real world usernames or passwords on the net)

        Also it is not the part that would do the actual authentication.

        When cross-checking Net::SMTP's auth method against the module list provided I noticed Authen::SASL is missing in there.

        Cheers, Sören

        Créateur des bugs mobiles - let loose once, run everywhere.
        (hooked on the Perl Programming language)

        More and more providers change the rules for how they accept mails from their clients. SMTP on port 25 is reserved for communication with other systems (i.e. to deliver mails to the provider's clients), clients should deliver their mails to port 587 (submission service) to send mail.

        Try changing $port = 25; to $port = 587;. This may give you the same results, because usually the port 587 requires a login, too. Try contacting the ipower support for mail delivery account name and password.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        Further clarification: the module is supposed to Authenticate the email so I can use IPower Host. (And thanks Sören for the links!)
Re: Authenticate email
by Happy-the-monk (Canon) on Mar 04, 2015 at 16:51 UTC

    I was provided a script ... You can use Net/SMTP.pm module. ... Please check for the email module. Could someone provide me with an example string ... Is there a specific place within the script that it needs to be?

    Trying to find out, what it is you are looking for. "IPOWER's UNIX platform" is something I had not heard before, ever.

    I followed the link you provided and found "Net/SMTP.pm" mentioned there. Maybe you will have to install it if you haven't done it yet.

    If you need documentation for Net::SMTP, it has an auth method for authentication, maybe that is helpful.

    Otherwise, judging from your post, everything should be done in your script already. As I don't know said script, I cannot divine what else needs to be told. (Authentication should be done early, probably...)

    Cheers, Sören

    Créateur des bugs mobiles - let loose once, run everywhere.
    (hooked on the Perl Programming language)

      Just wanted to say thanks again for the help. Rereading this thread, I think I may have let my frustration at this whole situation seep through. I apologize. It was not frustration at you kind people. I hope I didn't offend anyone.

      ~Diana

        Thanks for the thanks. And no offense taken: frustration at obstacles is not unknown to me.

        Cheers, Sören

        Créateur des bugs mobiles - let loose once, run everywhere.
        (hooked on the Perl Programming language)

Re: Authenticate email
by BillKSmith (Monsignor) on Mar 04, 2015 at 20:00 UTC
    What do you mean by "Authenticate"? (Verify that a string is a syntactically valid email address or that it is a currently active email account) Clearly your method will depend on your goal.
    Bill
      I don't know the answer to that. The route of an "Email" would be from the HTML website/survey (such as http://core-research.biz/test/index13.htm). An individual would fill out that survey, then when they click "Submit" there is an email of their responses created and sent to me (survey@mydomain.biz). HTML and Perl Script are both now hosted on the IPowerWeb Host.

        Here is the entire script. I believe I just need to add a (hopefully) small bit to be able to include my user name and password and have it work with the Net/SMTP.pm module:

        #!/usr/bin/perl #First released with snap 10 $port = 25; #SMTP PORT NUMBER $smtpServer = 'smtp.ipower.com'; $domain = 'mydomain.biz'; $sWebMaster='myemail@mydomain.biz'; $sReturnURL='http://mydomain.biz'; $sReturnText='Submit'; use Socket; use URI::Escape; $SIG{'INT'} = 'dokill'; sub dokill { kill 9,$child if $child; } ($name,$aliases,$proto) = getprotobyname('tcp'); ($name,$aliases,$port) = getservbyname($port,'tcp') unless $port =~ /^\d+$/;; ($name,$aliases,$type,$len,$thataddr) = gethostbyname($smtpServer); my $iaddr = inet_aton($smtpServer); $that = sockaddr_in($port, $iaddr); read(STDIN , $buffer , $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/ , $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; #Translate + to <space> $value =~ s/%0D/ /g; $value =~ s/%0A/ /g; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; #C +onvert Hex values $value =~ s/~!/ ~!/g; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; #Do + the same for the names $name =~ s/~!/ ~!/g; $FORM{$name} .= ';' if (defined($FORM{$name})); #Seperate multi + values with ; $FORM{$name} .= $value; #Add the value to the contr +ol name key } if($FORM{':COOKIE:'}) { if($ENV{'HTTP_COOKIE'} =~ /\QSURVEY=$FORM{':SURVEY:'}/) { print "Content-type:text/html\n\n"; print "\n\n"; print "<HTML>\n"; print "<HEAD><TITLE>Data Received</TITLE></HEAD>\n"; print "<BODY BGCOLOR=\"#FFFFFF\">\n"; print "<FONT FACE=ARIAL>\n"; print "<CENTER><H2>Repeat Submission</H2>\n"; print "<P>You have already submitted data to this surve +y.Only one submission is allowed.\n"; print "<P><a href=\"$sReturnURL\">$sReturnText</a>\n"; print "</CENTER>\n"; print "</FONT></BODY></HTML>\n"; exit; } } $recipient = $FORM{':EMAIL:'}; #Get address from hidden + Email control #Check for malicous use of recipient if ($recipient =~ />|<|;|\\|\// ) { #Change this message to change the page returned when the email addres +s cannot be used print "Content-type:text/html\n\n"; print "\n\n"; print "<HEAD><TITLE>Invalid Email Address</TITLE></HEAD>\n"; print "<BODY BGCOLOR=\"#FFFFFF\">\n"; print "<CENTER><H2>The system is unable to process the</H2><BR +><BR>\n"; print "<CENTER><H2>email address in this form.</H2><BR><BR>\n"; print "Please report this error to $sWebMaster.</center>\n"; print "</BODY>\n"; exit; } if($FORM{':RECEIPT:'}) { $theQ = $FORM{':RECEIPT:'}; $sender = $FORM{$theQ}; #Get address from hidden Em +ail control #Check for malicous use of sender email if(length($sender)==0) { print "\n\n"; print "<HEAD><TITLE>No Email Address</TITLE></HEAD>\n"; print "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"# +0000ff\" VLINK=\"0000ff\">\n"; if($FORM{':RECEIPTLBL:'}) { print "<CENTER><H2>You have not given a contact email in $ +FORM{':RECEIPTLBL:'}.</H2><BR><BR>\n"; } else { print "<CENTER><H2>You have not given a contact email. +</H2><BR><BR>\n"; } print "<CENTER><H2>The address must be given so a receipt can +be sent</H2><BR><BR>\n"; print "Please use the back button on your browser to retur +n to the questionnaire and enter an address.</center>\n"; print "</BODY>\n"; exit; } } if (!socket(S, PF_INET, SOCK_STREAM, $proto)) { die $!; } if (!connect(S,$that)) { die $!; } select (S); $|=1; # flush select (STDOUT); $|=1; # flush #set up ESMTP session here $stat = <S>; die("500 fatal: bad message on connect: $stat") if ($stat !~ /^2/); print S "HELO $domain\r\n"; $stat = <S>; die("500 fatal: bad message on HELO: $stat") if ($stat !~ /^2/); print S "MAIL FROM:<surveyScript\@$domain>\r\n"; $stat = <S>; die("500 fatal: bad message on MAIL FROM: $stat") if ($stat !~ /^2/); print S "RCPT TO:<$FORM{':EMAIL:'}>"; print S "\r\n"; $stat = <S>; die("500 fatal: bad message on RCPT TO: $stat") if ($stat !~ /^2/); print S "DATA\r\n"; $stat= <S>; print S "To: $FORM{':EMAIL:'} \n"; print S"Subject: Internet submission of $FORM{':SURVEY:'} data\n\n"; print S "***START SURVEY DATA***\n"; my $doEscape = $FORM{':MSGENCODE:'} ? 1 : 0; if ($doEscape) { $FORM{':MSGENCODE:'} = "2"; } foreach $key (keys(%FORM)) { if ($key !~ /^:OKPAGE:$/) { my $val = $FORM{$key}; if ($doEscape) { $val = uri_escape($val, "^A-Za-z0-9\-_.!~*'()\x20@"); } print S "$key=$val\n"; } } print S "***END SURVEY DATA***\n"; print S "\r\n.\r\n"; $stat= <S>; die("500 fatal: bad message on DATA END: $stat") if ($stat !~ /^2/); print S "QUIT\r\n"; #close socket here close(S); if($FORM{':COOKIE:'}) { print "Set-Cookie: SURVEY=$FORM{':SURVEY:'} ; expires=$FORM{':COOK +IE:'}\n"; } if($FORM{':OKPAGE:'}) { print "Location: $FORM{':OKPAGE:'}\n\n"; }else{ print "Content-type:text/html\n\n"; print "<HEAD><TITLE>Thank-you</TITLE></HEAD>\n"; print "<BODY BGCOLOR=\"#FFFFFF\">\n"; print "<center>\n"; print "<h2>Thank You</h2>\n"; print "Thank you for taking the time to answer this survey.<p>\n"; print "Your response has been submitted succesfully to $FORM{':EMA +IL:'}.<p>\n"; print "<a href=\"$sReturnURL\">$sReturnText</a></center>\n"; print "</body>\n"; }