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.
| [reply] |
|
|
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';
| [reply] [d/l] |
|
|
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)
| [reply] |
|
|
|
|
|
|
|
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". ;-)
| [reply] [d/l] [select] |
|
|
|
|
Further clarification: the module is supposed to Authenticate the email so I can use IPower Host. (And thanks Sören for the links!)
| [reply] |
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)
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
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.
| [reply] |
|
|
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.
| [reply] |
|
|
#!/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";
}
| [reply] [d/l] |
|
|
|
|