|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by Folsomite in Perl Programming Language, SendMail Email Server, Simple Mail Transfer Protocol (SMTP)
I am trying to send an email from a perl script using MIME::Lite. I see this error:
"5.7.0 Must issue a STARTTLS command first",
The email doesn't go out. I am newbie in this area, please give me step-by-step instructions to resolve this.
Note that I have disabled firewall, but saw no difference. Also, I tried ports 465 and 587.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
|
This is the perl script I am using:
#!/usr/bin/perl -w
# use MIME::Lite package
use MIME::Lite;
# set up email
$to = "yyyy\@gmail.com";
$from = "yyyy\@gmail.com";
$subject = "Email Sent via Perl";
$message = "This email was sent using Perl.";
$file = "abc.html";
# send email
email($to, $from, $subject, $message, $file);
# email function
sub email
{
# get incoming parameters
local ($to, $from, $subject, $message, $file) = @_;
# create a new message
$msg = MIME::Lite->new(
From => $from,
To => $to,
Subject => $subject,
Data => $message
);
# add the attachment
$msg->attach(
Type => "text/plain",
Path => $file,
Filename => $file,
Disposition => "attachment"
);
# send the email
MIME::Lite->send('smtp', 'smtp.gmail.com', Timeout => 60);
$msg->send();
}
|
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625