#!/usr/bin/perl -w # This will be needed in order to connect to the remote POP3 server use IO::Socket::INET; # the mail host you want to send a mail to my $HOST = "xxx.xxxxx.xxx.xx:25"; # person your sending it to my $to = 'xxxxx@xxxxx.xxx.xx'; # email subject my $timedate = localtime; my $subject = "Test Email " . $timedate; # email body my $body = "This email serves as a test for the mail.samedaycredit.com.au to samedaycredit.com.au servers"; # from address my $from = "person\@example\.id\.au"; # connect to the host my $SOCKET = IO::Socket::INET->new( $HOST ); # Suck down the greeting and discard it my $RESPONSE = <$SOCKET>; # Start email chat with smtp server # send helo print $SOCKET "HELO server.example.com\r\n"; $RESPONSE = <$SOCKET>; print $RESPONSE ; # send mail from print $SOCKET "mail from:". $from . "\r\n"; $RESPONSE = <$SOCKET>; print $RESPONSE; # send rcpt to print $SOCKET "rcpt to:" . $to . "\r\n"; $RESPONSE = <$SOCKET>; print $RESPONSE; # send data print $SOCKET "data\r\n"; # Pick up the response $RESPONSE = <$SOCKET>; print $RESPONSE; print $SOCKET "from:" . $from . "\r\n"; print $SOCKET "To:" . $to . "\r\n"; print $SOCKET "Subject:" . $subject . "\r\n"; print $SOCKET $body . "\r\n"; print $SOCKET ".\r\n"; $RESPONSE = <$SOCKET>; print $RESPONSE ; # Log off print $SOCKET "QUIT\r\n"; $RESPONSE = <$SOCKET>; print $RESPONSE ; # Close the socket close($SOCKET);