阿里云的云虚拟主机安装wordpress使用qq邮件功能设置实例

博主也是小白一枚,刚刚想到了给网站加一个收发邮件功能,结果试了半天都不行,现在发篇文章记录一下我解决的方法, 避免自己以后忘记了。

首先要确认自己使用的主机是否支持邮件功能,这里我用的是阿里云的云虚拟主机,网上查了一下虚拟主机linux系统都是默认不支持mail函数和stmp的方式发信的,主机仅仅支持的发信方式是fsockopen。如果主机没开fsockopen的话则去主机后台开启,步骤:我的主机--> 管理--进入控制面板--站点信息--高级环境设置--php.ini设置--PHP函数fsockopen设置(启用即可)  

开启后进FTP后台在网站根目录找到wp-includes/class-smtp这个文件,建议修改前先备份一下,以免等下修改出错,打开class-smtp将下面的代码替换掉如图所示

将/**
$this->smtp_conn = @stream_socket_client(
$host . ":" . $port,
$errno,
$errstr,
$timeout,
STREAM_CLIENT_CONNECT,
$socket_context
);
*/
以上部分注释掉,使用
$this->smtp_conn = fsockopen($host, $port, $errno, $errstr);代替该部分

$this->smtp_conn = fsockopen($host, $port, $errno, $errstr);

替换成功后来到wordpress后台,安装一个邮箱插件,这里我用的是WP Mail SMTP,主机填写smtp.qq.com,加密方式选择465,smtp用户名就是邮箱地址,smtp密码不是qq密码哦,是进入qq邮箱获得第三方授权码,注意不要填写错了。

这些都填写完之后发送一封测试邮箱到自己的邮箱里看看是否设置成功了,如果成功了2秒左右邮箱就会收到测试邮件了,如下图所示。

按照这个方法设置后阿里云的云虚拟主机终于可以正常收发邮件了。其他主机请自测哦!

25 COMMENTS
  1. 2019/08/12
    安田佑叶

    有用,设置成功了

  2. 2021/08/03
    Ezcuyq

    cialis prescription online usa - 120 mg of cialis tadalafil 7mg

  3. 2021/08/04
    Lvgwef

    cost of viagra pills in india - buy generic viagra from europe 20mg sildenafil

  4. 2021/08/12
    Ruuaah

    ed pills online - erectile dysfunction drugs best ed pills non prescription uk

  5. 2021/08/13
    Gfzltc

    buy prednisone 10 mg - canada buy prednisone online prednisone pack

  6. 2021/08/15
    Sgynit

    buy generic sildenafil online - generic viagra 100mg price viagra mexico over the counter

  7. 2021/08/16
    Tnkbzs

    canada pharmacy online - Cialis usa cialis for sale in mexico

  8. 2021/08/18
    Wpcprk

    ivermectin 8 mg - stromectol oral ivermectin 50

  9. 2021/08/20
    Fnmasi

    natural pills for erectile dysfunction - ed treatment drugs online ed medications

  10. 2021/08/22
    Dfhgvl

    ipratropium albuterol - cheap albuterol ventolin price

  11. 2021/08/24
    Agycad

    cytotec over the counter usa - cytotec singapore pharmacy where to buy cytotec online in canada

  12. 2021/08/25
    Gofqmo

    doxycycline tablets where to buy - buy generic doxycycline doxycycline pills buy

  13. 2021/08/26
    Aieyib

    neurontin generic south africa - neurontin pills levothyroxine 50mcg

  14. 2021/08/28
    Qdikiw

    viagra buy usa - price of sildenafil citrate

  15. 2021/08/28
    Cialis

    Viagra 100mg Test

  16. 2021/08/29
    this web hosting

    Hi my family member! I want to say that this post
    is awesome, nice written and come with approximately all significant infos.
    I would like to see extra posts like this .

  17. 2021/08/29
    Siatsc

    cialis men - cialis pills for sale best online pharmacy no prescription

  18. 2021/08/30
    t.co

    Excellent goods from you, man. I've understand
    your stuff previous to and you are just extremely excellent.
    I really like what you have acquired here, really like what you're saying
    and the way in which you say it. You make it entertaining and you still care for to keep it sensible.
    I can not wait to read far more from you.
    This is really a great web site.

  19. 2021/08/30
    cliette
  20. 2021/08/30
    loyache
  21. 2021/08/31
    Crbbol

    buy vardenafil in canada - buy vardenafil online without prescription buy vardenafil online uk

  22. 2021/09/01
    http://t.co

    I am not sure where you're getting your information, however great
    topic. I must spend some time studying more or working out more.
    Thanks for great information I used to be looking for this info for my mission.

  23. 2021/09/01
    Uofuku

    buy ivermectin for humans - stromectol cost

  24. 2021/09/02
    bit.ly

    I don't even understand how I finished up right
    here, but I believed this submit used to be good.
    I don't know who you are but certainly you're going to a well-known blogger in case you aren't already.

    Cheers!

  25. 2021/09/02
    Iywtek

    deltasone generic - prednisone 20 mg medication purchase prednisone

loading