这是关于前几天文章的一个补充 通过邮件内容,获得对方的网站真实IP 附隐藏方法
同样本功能无需任何要求,发送邮件,可使用自己邮箱,也可使用小幻open_mail_api@ihuan.me邮箱,可完美结局无法使用SMTP、mail()函数发送邮件的困境(不过下文只放邮件提醒,其他自己看着办吧)
邮件API地址:http://mail.api.ihuan.me/smtp-to-wp.php 数据使用POST方式发送,相关参数后边有
好吧,承认发上篇文章,让张戈骂了一通,不过听说他最近好像也找到解决方法了,不过,我这里可以提供代发,使用POST提交数据 无需SMTP链接,完美解决主机不支持mail()、SMTP的问题哦,同样发送IP为小幻的万网代发服务器。(隐藏IP)
//评论回复邮件通知(所有回复都邮件通知)
function comment_mail_notify($comment_id) {
$comment = get_comment($comment_id);
$parent_id = $comment->comment_parent ? $comment->comment_parent : '';
$spam_confirmed = $comment->comment_approved;
if (($parent_id != '') && ($spam_confirmed != 'spam')) {
//$wp_email = 'no-reply@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); //e-mail 发出点, no-reply 可改为可用的 e-mail.
$to = trim(get_comment($parent_id)->comment_author_email);
$subject = '您在 [' . get_option("blogname") . '] 的留言有了回复';
$message = '
<div style="background-color:#fff; border:1px solid #666666; color:#111;
-moz-border-radius:8px; -webkit-border-radius:8px; -khtml-border-radius:8px;
border-radius:8px; font-size:12px; width:702px; margin:0 auto; margin-top:10px;
font-family:微软雅黑, Arial;">
<div style="background:#666666; width:100%; height:60px; color:white;
-moz-border-radius:6px 6px 0 0; -webkit-border-radius:6px 6px 0 0;
-khtml-border-radius:6px 6px 0 0; border-radius:6px 6px 0 0; ">
<span style="height:60px; line-height:60px; margin-left:30px; font-size:12px;">
您在<a style="text-decoration:none; color:#00bbff;font-weight:600;"
href="' . get_option('home') . '">' . get_option("blogname") . '
</a>博客上的留言有回复啦!</span></div>
<div style="width:90%; margin:0 auto">
<p>' . trim(get_comment($parent_id)->comment_author) . ', 您好!</p>
<p>您曾在 [' . get_option("blogname") . '] 的文章
《' . get_the_title($comment->comment_post_ID) . '》 上发表评论:
<p style="background-color: #EEE;border: 1px solid #DDD;
padding: 20px;margin: 15px 0;">' . nl2br(get_comment($parent_id)->comment_content) . '</p>
<p>' . trim($comment->comment_author) . ' 给您的回复如下:
<p style="background-color: #EEE;border: 1px solid #DDD;padding: 20px;
margin: 15px 0;">' . nl2br($comment->comment_content) . '</p>
<p>您可以点击 <a style="text-decoration:none; color:#00bbff"
href="' . htmlspecialchars(get_comment_link($parent_id)) . '">查看回复的完整內容</a></p>
<p>欢迎再次光临 <a style="text-decoration:none; color:#00bbff"
href="' . get_option('home') . '">' . get_option("blogname") . '</a></p>
<p>(此邮件由系统自动发出, 请勿回复.)</p>
</div>
</div>';
$message = convert_smilies($message);
//$from = "From: \"" . htmlspecialchars(get_option('blogname'),ENT_QUOTES) . "\" <$wp_email>";
//$headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n";
//wp_mail( $to, $subject, $message, $headers );
//echo 'mail to ', $to, '<br/> ' , $subject, $message; // for testing
$xm_smtp_data = array ("host" =>"" ,"address" => "","user" => "","pass" => "","fromname" => "");
//如果有自己的SMTP则输入,没有则不填
$xm_mail_data = array ("to" => $to,"subject" => $subject,"message" => $message);
$xm_post_data = array_filter(array_merge ($xm_smtp_data, $xm_mail_data));
$xm_url = "http://mail.api.ihuan.me/smtp-to-wp.php";
$xm_ch = curl_init();
curl_setopt($xm_ch, CURLOPT_URL, $xm_url);
curl_setopt($xm_ch, CURLOPT_RETURNTRANSFER, 1);
// post数据
curl_setopt($xm_ch, CURLOPT_POST, 1);
// post的变量
curl_setopt($xm_ch, CURLOPT_POSTFIELDS, $xm_post_data);
$xm_output = curl_exec($xm_ch);
curl_close($xm_ch);
if ($xm_output['err_no']==0) return true;
return false;
}
}
add_action('comment_post', 'comment_mail_notify');
最后那些 我注释掉了使用wp_mail 直接发送POST数据到我的邮件API
变量$to 为发送到的目标地址$subject 为邮件主题 $message为内容 (不要改数组)
当然变量内容可以不是小幻上面放着的邮件提醒样式
不修改代码则使用小幻的邮件API 如果修改$xm_smtp_data数组中key 后“” 则使用小幻API连接SMTP再发送
这些任务只有发送POST数据和你的主机有关。
自定义SMTP数组示例(不用千万不要填写)
$xm_smtp_data = array ("host" =>"smtp.qq.com" ,"address" => "i@ihuan.me","user" => "123","pass" => "123","fromname" => "小幻");
同样host这些也都是POST的数据,不过不填写,则过滤掉,自然不会连接SMTP,直接用小幻的。
好了就这些,以后有时间会弄个插件来玩玩,直接用wp_mail发送,就不会呢么麻烦了。
2015-7-11 补充:
接受建议,直接使用本站API邮箱发送的,也可以自己命名发件人名称了。
在xm_mail_data数组中增加 “fromname”=>"发件人名称" 同样可以自定义发件人名称哦!
模版真的可以更换,这里只是小幻用的一个模版,你可以把你以前的扣下来放进去,也可以用的!
You actually make it seem so easy along with your presentation but I find this matter to be actually something which I believe I might never understand.
2018年8月8日 17:27It kind of feels too complex and extremely broad for me.
I am looking ahead for your subsequent put up, I’ll try to get the hold of it!
if you really need to become expert in driving, your really need to enroll in a driving school.
2018年8月6日 00:31As the admin of this web page is working, no question very
2018年7月25日 10:03rapidly it will be well-known, due to its feature contents.
Excellent pieces. Keep posting such kind of information on your site.
2018年7月22日 13:04Im really impressed by it.
Hi there, You’ve done an incredible job. I’ll definitely digg it and personally suggest to my friends.
I am confident they’ll be benefited from this site.
I’m impressed, I have to admit. Genuinely rarely should i encounter a weblog that’s both educative and entertaining, and let me tell you, you may have hit the nail about the head. Your idea is outstanding; the problem is an element that insufficient persons are speaking intelligently about. I am delighted we came across this during my look for something with this.
2018年6月23日 09:52学习,大佬多多关照
2017年12月14日 15:58好了,现在我套上了(小幻大佬666
2017年10月11日 19:33大佬,我就问一下,我的SMTP是SSL的可以不
2017年7月29日 18:23因为使用的是google cloud屏蔽了传统的smtp端口,我开始使用Mailgun进行转发,但是后来因为Mailgun使用共享IP导致邮件一直进垃圾邮箱,而QQ邮箱直接拒收了邮件,一直很苦恼如何处理,今天百度偶然发现你的博客,这个正好可以解决我的问题,但是如果我想把我的站点的所以邮件发送都调用这个应该怎么办呢?因为我并不会PHP,只能靠百度一步一步摸索,所以不耻下问,下面这个是我的主题的mail.php 的源码 http://pan.baidu.com/s/1boHq5Ev 希望站长可以给我稍微指点一下。
2017年6月26日 22:00以上评论作废,因为发现了这篇文章https://ihuan.me/3284.html
2017年6月26日 22:39阿里云也屏蔽25→_→
2017年6月27日 11:36博主,这个方法还能使用吗?如果能打算用你的这个,但不知会不会在网页源代码里加入某些东西?还望回复告知,不胜感激!
2016年10月25日 02:01这个目前还可以用的,源码就这些,看看就知道了…怎么添加…
2016年10月28日 22:10亲爱的,DZ3.2的论坛如何才能隐藏IP地址?
2016年12月1日 21:33CDN…
2016年12月5日 11:04