我们在使用PHPMailer使用Gmail来发送邮件的连接smtp服务器错误提示:smtp error could not connect to smtp host !了,这个是因为extension=php_openssl.dll未开启导致的哦。
使用的PHPMailer版本:5.2.1,以下是PHPMailer的example文件夹里给出的:test_gamil_basic.php的部分代码,代码如下:
- $mail = new PHPMailer();
- $body = file_get_contents('contents.html'); //$body = $_POST['body'];
- $body = eregi_replace("[]",'',$body);
- $mail->IsSMTP(); // telling the class to use SMTP
- $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
- // 1 = errors and messages
- // 2 = messages only
- $mail->SMTPAuth = true; // enable SMTP authentication
- $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
- $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server or ssl://smtp.gmail.com
- $mail->Port = 465; // set the SMTP port for the GMAIL server
- $mail->Username = "yourusername@gmail.com"; // GMAIL username
- $mail->Password = "yourpassword"; // GMAIL password
- $mail->SetFrom('name@yourdomain.com', 'First Last');
- $mail->AddReplyTo("name@yourdomain.com","First Last");
- $mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML($body);
- $address = "whoto@otherdomain.com";
- $mail->AddAddress($address, "John Doe");
- $mail->AddAttachment("images/phpmailer.gif"); // attachment
- $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- } else {
- echo "Message sent!";
- }
按照这个例子给出的代码操作,我遇到了以下错误:
提示您 smtp error could not connect to smtp host !的错误提示,google了下,发现是需要开启PHP的openssl扩展:
extension=php_openssl.dll //去掉最前面的分号,重启apache或nginx服务器。
HoHo~成功发送。
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » PHPMailer使用Gmail来发送邮件的连接smtp服务器错误
波比源码 » PHPMailer使用Gmail来发送邮件的连接smtp服务器错误
buy levofloxacin 500mg order levaquin 500mg generic
buy dutasteride sale zofran oral order zofran generic
purchase aldactone sale valtrex 1000mg without prescription order diflucan 200mg pill
acillin us cephalexin us generic erythromycin
sildenafil online bimatoprost order purchase robaxin online
cheap suhagra 50mg sildenafil pills 200mg order estradiol 2mg generic
purchase lamotrigine online order mebendazole online retin cream generic
accutane 20mg usa amoxil 1000mg without prescription azithromycin 250mg sale
buy generic indomethacin 75mg cefixime tablet amoxicillin 500mg us
arimidex 1 mg brand Free trial of viagra cheap sildenafil without prescription
buy doxycycline 100mg online buy generic vardenafil 20mg order furosemide pill
altace brand irbesartan 300mg without prescription order azelastine 10 ml sprayer
order clonidine online cheap catapres us buy tiotropium bromide 9 mcg generic
order buspar 10mg generic order dilantin 100 mg pills ditropan generic
benicar 10mg sale buy generic depakote 500mg purchase diamox generic
order prograf without prescription labetalol 100mg oral ursodiol 300mg drug
oral isosorbide isosorbide cost order telmisartan 80mg online
order zyban 150 mg for sale cheap strattera order generic seroquel 50mg
purchase molnupiravir sale molnupiravir 200 mg sale order generic lansoprazole
oral sertraline 100mg purchase zoloft for sale order generic viagra
revia for sale online buy generic albenza aripiprazole 30mg brand
purchase provera generic purchase microzide online purchase periactin generic
piracetam 800mg brand canadian viagra order viagra sale
buy zithromax 500mg sale order prednisolone 5mg online neurontin 100mg oral
cheap tadalafil 5mg sildenafil 50mg pills for men sildenafil 50mg usa
order lasix 100mg generic order doxycycline 100mg sale buy hydroxychloroquine 400mg generic
order cialis 40mg tadalafil canada anafranil cheap
buy metformin 1000mg without prescription order tadalafil 10mg online cheap order tadalafil 5mg for sale
cost norvasc 10mg order generic amlodipine 10mg buy cialis 5mg generic
buy prilosec generic affordable term papers play blackjack online
order lopressor buy lopressor 100mg pills vardenafil oral
clomiphene 50mg for sale purchase albuterol sale online casino games real money
cialis from india tadalafil 10mg brand order viagra
buy generic triamcinolone 4mg desloratadine for sale online clarinex us
order dapoxetine 90mg pills buy priligy online cheap buy levothyroxine for sale
oral orlistat zovirax 800mg canada zovirax 400mg cost
order tadalafil 20mg online buy cialis 5mg generic plavix us
allopurinol without prescription ezetimibe 10mg without prescription order ezetimibe
buy motilium online cheap purchase motilium online buy cyclobenzaprine 15mg sale
losartan price buy cozaar 50mg pill topiramate online
order imitrex for sale cheap levofloxacin 500mg avodart buy online
order colchicine for sale blackjack online online casino games real money
cost zantac 150mg celebrex medication celecoxib 200mg for sale
simvastatin tablet finasteride ca finasteride online
buy fluconazole 200mg pills fluconazole drug viagra 50mg tablet
cialis 40mg sale cialis next day delivery sildenafil 50mg uk
real viagra pills viagra online order order tadalafil pills
casino games online real money generic cialis 5mg tadalafil 20mg for sale
generic trazodone order trazodone generic order aurogra 50mg pills
cheap thesis binding essay helper online stromectol 15 mg
buy sildalis generic order lamotrigine pills lamictal 50mg brand
no deposit free spins casino slots meaning tadalafil 40mg us
buy lasix generic furosemide tablet plaquenil 400mg over the counter
order deltasone 20mg generic minipress 1mg pills mebendazole usa