[問題]利用Gmail寄信模組無法連線smtp server

作者: mate99 (kkk)   2015-09-21 11:07:27
最近試著利用模組Email::Send::SMTP::Gmail寄信
但是當我將smtp server設定成smtp.gmail.com會無法將信件寄出
會出現錯誤訊息:
Connecting to smtp.gmail.com using tls with LOGIN on port 587 and timeout of
60
Could not connect to SMTP server
Can't locate object method "send" via package "Net::SMTPS: connect: Network
is unreachable" (perhaps you forgot to load "Net::SMTPS: connect: Network is
unreachable"?) at gmail.pl line 22.
但是當我將smtp server改成ip時就可運作
我確認我主機有設定dns,可用nslookup指令正解域名
我的主機OS是CentOS 6.7
程式碼如下:
#!/usr/bin/perl -w
#
use warnings;
use Email::Send::SMTP::Gmail;
@test=("aaaaaa","bbbbbbbbbbbbb","ccccccc");
my $mail=Email::Send::SMTP::Gmail->new(
-smtp=>'smtp.gmail.com',
# -smtp=>'64.233.189.109',
-login=>'[email protected]/*
作者: flu (Crazy Rhythm)   2015-09-21 19:33:00
基本的建議是google說明看了嗎 https://goo.gl/3kPFzRhttp://goo.gl/ikNGqY 說的 套件相依性解決了嗎, 物件(就是 $mail)產生成功了嗎, verbose的debug用 錯誤訊息是什麼
繼續閱讀

Links booklink

Contact Us: admin [ a t ] ucptt.com