[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Anyone...?



>Anyone have any idea why this doesn't work? I'm at a loss, and I think I've
>tried everything I can think of. The send() and recv() routines don't give
>me much either... they all sort of run forever without any extra output
>after the initial $msg.
>
>require "GUSI.ph";
>use Socket;
>
>$serv = "mail.serv.er";

insert here:

$NWNL = "\r\n";		# Network New line (carriage-return,line-feed)

>
>socket(Seraph, PF_INET, SOCK_STREAM, 6);
>	$sin = sockaddr_in("25",inet_aton("$serv"));
>	$conn = connect(Seraph,$sin);
>	die "Connection couldn't be made. $!" if ($conn != 1);
>	$msg = <Seraph>;
>	if ($msg !~ /^220/) {die "Host not responding correctly.";}
>	print "$msg";

change

>	print Seraph "EHLO\n";

to

	print Seraph "EHLO$NWNL";

>	$msg = <Seraph>;
>	print "$msg\n";
>close(Seraph);
>
[stuff deleted]

SMTP daemons (most, all? most/all IP server daemons?) run on network
newlines (carriage-return,line-feed), so the server is waiting for
it, you've only sent a line-feed. I've been bit by this behaviour
in virtually identical code :-).

Tom.


Tom Kimpton
--
Mrs. Bun: Have you got anything without spam?
Waitress: Well, there's spam egg sausage and spam, that's not got
much spam in it.
Mrs. Bun: I don't want any spam!



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch