2

WordPress 邮件代理

 2 years ago
source link: https://www.taterli.com/8473/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

WordPress 邮件代理

开发了一个小小的插件,只有几行代码.

这个解决一个问题是,使用国内邮箱发国外到达率低,使用国外邮箱国内很难访问,使用邮件代发服务嘛又很多有低消或者各种认证,因此,用虚拟主机解决问题看看.

另外它始终只是玩具一般的东西,所以文档也不会写,就当个记录,分为一端在虚拟主机部署,一端在本机部署.

<?php

/**
 * @package Mail_Proxy
 * @version 1.0.0
 */

/*
Plugin Name: 邮件代理
Plugin URI: https://www.taterli.com/
Description: 把发送邮件的需求代理到远程虚拟主机去,使用远程的虚拟主机发邮件,这样就可以使用墙外的邮件服务了.
Author: TaterLi
Version: 1.0.0
Author URI: https://www.taterli.com/
*/

function remote_mail($args)
{
	$ret = wp_remote_post(
		'http://send.example.org/send.php',
		array(
			'blocking'    => true,
			'headers'     => array('Content-Type' => 'application/x-www-form-urlencoded'),
			'body'        => array('to' => base64_encode($args['to']), 'subject' => base64_encode($args['subject']), 'message' => base64_encode($args['message']), 'headers' => base64_encode($args['headers'])),
		)
	);
}

add_filter('wp_mail', 'remote_mail');

服务器端:

<?php
$to = base64_decode($_POST['to']);
$subject = base64_decode($_POST['subject']);
$message = base64_decode($_POST['message']);
$headers = base64_decode($_POST['headers']);

mail($to,$subject,$message,$headers);

毕竟虚拟主机每天配额不用白不用.


Recommend

  • 122
    • 掘金 juejin.im 6 years ago
    • Cache

    node.js使用Nodemailer发送邮件

    原文链接:Node.js使用Nodemailer发送邮件 电子邮件是—种用电子手段提供信息交换的通信方式,是互联网应用最广的服务。通过网络的电子邮件系统,用户可以以非常低廉的价格(不管发送到哪里,都只需负担网费)、非常快速的方式(几秒钟之内可以发送到世界上任何

  • 142

    问与答 - @ionblue - 一直在用小恐龙基金会 /公司的 thunderbird,但是这个和我的审美有些出入。昨天找了几个,要么是丑,要么是多邮箱要付费。感觉 eM Client 的颜值还可以,但是价格有点虚高。像 mailb

  • 220
    • www.v2ex.com 6 years ago
    • Cache

    收到阿里云的警告邮件 - V2EX

    云计算 - @yanw - > 您好 ,接主管部门通知,您的主机存在通过技术手段使其成为境内获取境外非法信息的途径等行为,根据《互联网信息服务管理办法》第十五条规定九不准内容及阿里云服务条款 3.1.3.11.请您在二十四小时内

  • 100

    404 | 百度EUX 页面搬家啦,点击此处跳转2 s 后将自动跳转

  • 153

    查快递、收邮件、订阅 RSS……除了聊天 Telegram 还有这些实用功能

  • 6

    当前位置: 陈沩亮博客 » WordPress插件 » WordPress无法发送邮件?WP SMTP插件配置其他邮箱方法WordPress...

  • 7
    • www.huhexian.com 2 years ago
    • Cache

    WordPress如何配置SMTP服务发送邮件

    WordPress如何配置SMTP服务发送邮件 2021-12-0309:57:11...

  • 8

    WordPress发送邮件很慢的解决方法 作者: xusx 分类: 其它 发布时间: 2022-03-21 21:22...

  • 5

    如何添加 WordPress 验证码以减少垃圾邮件 如果您曾被要求在网站上执行操作之前解决一个简单的数学问题或“证明您是人类” – 您遇到了验证码。 这个简单的功能无处不在是有充分理由的。 事实上,您可能需要考虑将 WordPress 验证码添加...

  • 5
    • chenjiehua.me 1 year ago
    • Cache

    Nginx反向代理wordpress

    Nginx反向代理wordpress Nginx作为一个性能强悍的 web 服务器,用来配置 wordpress 简直小菜一碟。不过,我们今天要聊的是另外一...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK