#!/usr/bin/perl use strict; use warnings; use IO::Socket::SSL qw(debug3); use Net::SMTP; use CGI::Carp qw(fatalsToBrowser); use English '-no_match_vars'; our @ARGV = ( 'mygmail@gmail.com', 'mypassword', 'touser@forumsoftware +.com', 'mygmail@gmail.com' ); my $body = "Test message"; my $headers = "Content-Type: text/plain\r\n\r\n"; my $smtp_server = 'smtp.gmail.com'; my $port = 587; my $mailer = new Net::SMTP( $smtp_server, Hello => 'host.domain.net', Port => $port, Debug => 1, User => $ARGV[0], Password => $ARGV[1], ) || die "Unable to create Net::SMTP object. Server: '$smtp_server', port '$port'\n\n" . $OS_ERROR; $mailer->auth($ARGV[0], $ARGV[1]); $mailer->mail($ARGV[3]); $mailer->to($ARGV[2]); $mailer->data(); $mailer->datasend("Subject: Net::SMTP test\r\n\r\n" . $headers . $body); $mailer->dataend; $mailer->quit; print "Content-type: text/html\n\n" or croak 'cannot print line1'; print "Complete"; exit();