Skip to content

Instantly share code, notes, and snippets.

@aanoaa
Created April 2, 2013 01:38
Show Gist options
  • Save aanoaa/5289294 to your computer and use it in GitHub Desktop.
Save aanoaa/5289294 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Net::SMTP;
my $smtp = Net::SMTP->new('localhost', Debug => 1); # FIXME: strong dependecies
die "smtp error\n" unless $smtp;
my $subject = 'test mail';
my $body = "iron body\n";
my $from = '[email protected]';
# my $to = '[email protected]';
my $to = '[email protected]';
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("Content-Type: text/plain; charset=UTF-8\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("To: $to\n");
$smtp->datasend("\n");
$smtp->datasend("$body\n");
$smtp->dataend();
$smtp->quit;
@yongbin
Copy link

yongbin commented Apr 2, 2013

Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.67)
Net::SMTP>>>   IO::Socket::INET(1.33)
Net::SMTP>>>     IO::Socket(1.34)
Net::SMTP>>>       IO::Handle(1.33)
Net::SMTP=GLOB(0x25dcdb0)<<< 220 r.silex.kr ESMTP Postfix (Debian/GNU)
Net::SMTP=GLOB(0x25dcdb0)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x25dcdb0)<<< 250-r.silex.kr
Net::SMTP=GLOB(0x25dcdb0)<<< 250-PIPELINING
Net::SMTP=GLOB(0x25dcdb0)<<< 250-SIZE 10240000
Net::SMTP=GLOB(0x25dcdb0)<<< 250-VRFY
Net::SMTP=GLOB(0x25dcdb0)<<< 250-ETRN
Net::SMTP=GLOB(0x25dcdb0)<<< 250-STARTTLS
Net::SMTP=GLOB(0x25dcdb0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x25dcdb0)<<< 250-8BITMIME
Net::SMTP=GLOB(0x25dcdb0)<<< 250 DSN
Net::SMTP=GLOB(0x25dcdb0)>>> MAIL FROM:<[email protected]>
Net::SMTP=GLOB(0x25dcdb0)<<< 250 2.1.0 Ok
Net::SMTP=GLOB(0x25dcdb0)>>> RCPT TO:<[email protected]>
Net::SMTP=GLOB(0x25dcdb0)<<< 250 2.1.5 Ok
Net::SMTP=GLOB(0x25dcdb0)>>> DATA
Net::SMTP=GLOB(0x25dcdb0)<<< 354 End data with <CR><LF>.<CR><LF>
Net::SMTP=GLOB(0x25dcdb0)>>> Content-Type: text/plain; charset=UTF-8
Net::SMTP=GLOB(0x25dcdb0)>>> Subject: test mail
Net::SMTP=GLOB(0x25dcdb0)>>> To: [email protected]
Net::SMTP=GLOB(0x25dcdb0)>>> iron body
Net::SMTP=GLOB(0x25dcdb0)>>> .
Net::SMTP=GLOB(0x25dcdb0)<<< 250 2.0.0 Ok: queued as E9CC261D57
Net::SMTP=GLOB(0x25dcdb0)>>> QUIT
Net::SMTP=GLOB(0x25dcdb0)<<< 221 2.0.0 Bye

발송성공한거 같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment