全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 884|回复: 10

求大神 低成本 网站 SMTP邮件解决方案

[复制链接]
发表于 2021-2-26 10:46:38 | 显示全部楼层 |阅读模式
求 低成本 网站 SMTP邮件解决方案
发表于 2021-2-26 10:49:37 来自手机 | 显示全部楼层
在用阿里邮件推送
发表于 2021-2-26 10:50:04 | 显示全部楼层
宝塔或者  EwoMail 这俩,关掉邮杀病毒的    1g内存都能跑
发表于 2021-2-26 10:50:58 | 显示全部楼层
昨天建了个iredmail,感觉还行
 楼主| 发表于 2021-2-26 14:46:05 | 显示全部楼层
研究下怎么弄,刚才看   https://github.com/PHPMailer/PHPMailer
发表于 2021-2-26 14:57:15 | 显示全部楼层
自建好了。看这个:
https://pengfamily.de/send-email-correctly-from-within-ubuntu-vps/
发表于 2021-2-26 14:57:40 | 显示全部楼层
腾讯企业邮箱,我一直用这个
 楼主| 发表于 2021-2-26 17:07:54 | 显示全部楼层
jeffpan 发表于 2021-2-26 14:57
自建好了。看这个:
https://pengfamily.de/send-email-correctly-from-within-ubuntu-vps/

然后编写脚本以发送统计报告以进行博客访问。

#!/usr/bin/perl
use strict;
use POSIX;
use Email::Send::YYClouds;
use LWP::Simple;
use JSON;
use utf8;

my $date = strftime "%F",localtime;
my $subject = "Daily visit statistics - $date";

my $log = "/var/log/apache2/access.log";
my %hash;

open HD,$log or die $!;
while (<HD>) {
     # a regex for matching the correct visit IP
     next unless m{^(\d+\.\d+\.\d+\.\d+).*\"GET /.*?/ HTTP/};
     my $ip=$1;
     $hash{$ip} ++;
}
close HD;

my $body = '<table style="width:100%">' . "\n";

for my $ip (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
     my $num = $hash{$ip};
     my $loc ="";

     if ($num>=2) {
         # get IP location via public api
         $loc = ip_loc($ip);
     }

     $body .= <<DATA;
<tr>
   <td>$ip</td>
   <td>$num</td>
   <td>$loc</td>
</tr>
DATA
}

$body .= '</table>';
  
#
# send email
#
my $msg = Email::Send::YYClouds->new();
$msg->send(recepient => ['wesley@sample.com'],
            sender => 'info@myhostnames.com',
            smtprelay => 'localhost',
            subject => $subject,
            body => $body,
       );

#
# ip query
#
sub ip_loc {
     my $ip = shift;
     my $content = get("https://ipapi.co/$ip/json/");
     if (defined $content) {
         my $json = decode_json($content);
         return $json->{city}. ", " . $json->{region}. ", ". $json->{country};
     } else {
         return "";
     }
}

前面都做完了,这个部分需要怎么修改以便执行,谢谢大神
发表于 2021-2-26 18:34:33 | 显示全部楼层
犀首 发表于 2021-2-26 10:50
宝塔或者  EwoMail 这俩,关掉邮杀病毒的    1g内存都能跑

我用过EWO 效果还不错,前提是你主机开了邮件端口
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-20 10:59 , Processed in 0.065455 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表