mailgun一个强大且适合开发者使用的(群)发邮件服务 - 邮箱资源 - 如有乐享

文章目录

mailgun一个开发人员的电子邮件服务,强大的API,使您能够轻松发送,接收和跟踪电子邮件。

每个月可免费发送10000封邮件,可以添加1000个域名,每封邮件都有跟踪日志,简单明了的管理界面。

官网

https://www.mailgun.com

注册步骤

1) 访问地址 https://app.mailgun.com/new/signup/

填写相关信息,点击注册。

关于信用卡可以使用之前提到的免费信用卡来验证。

yandex.ru来自俄罗斯虚拟_信用卡_申请指南

注册Wirex账号,申请虚拟_信用卡_

2)注册成功后,到需要到注册邮箱点击验证链接。需要验证手机号码。

3)验证成功后,就可以使用了。特别要注意,新注册的用户有发件速度限制。

您的帐户正在试用期,域名限制为100封/小时。 如果您继续发送良好的流量,该限制将被删除。

添加域名

注册成功后,我们来添加自己的域名。

1)访问地址 https://app.mailgun.com/app/domains/new

填写要绑定的域名,然后点击添加。

本文演示域名位 mailgun.somecolor.cc

注意域名需要独立解析才可以。如果这里要绑定二级或者三级域名。请先参考文章:_二级域名_如何实现NS的独立解析

2)点击添加后,页面显示要解析的内容。

有TXT 、MX、CNAME,按照提示依次添加解析。

3)解析添加完成,然后验证一下。验证成功后,就可以看见关键的信息了。

有的运营商生效可能比较慢。

4)通过CURL 发送邮件到 163邮箱。速度非常快,但是进垃圾箱。

替换自己的API KEY 试一试。

注意:QQ邮箱可能无法接收或者接收速度非常慢。后面我们介绍一下。

1

2

3

4

5

6

7

复制你的API KEY 、API Base URL、 FROM EMAIL

curl -s --user 'api:key-a5b555827e4a134623c5caxxxxx' \

https://api.mailgun.net/v3/mailgun.somecolor.cc/messages \

-F from='Mailgun Sandbox <postmaster@sandboxed092a69c6d645b8a7c204427fc0a681.mailgun.org>' \

-F to='ma <xxxxx@163.com>' \

-F subject='Hello ma' \

-F text='Congratulations ma, you just sent an email with Mailgun! You are truly awesome!'

演示代码

mailgun 强大的地方就是API。官网首页推荐语就是 :The Email Service For Developers

其官网的文档有详细的介绍。

有兴趣可参阅: https://documentation.mailgun.com/api_reference.html

 远程验证电子邮箱是否可用

以下是官方给的示例代码,支持目前主流的开发语言。

直接替换你的API KAY / API Base Url 等信息即可使用了。

CURL

1

2

3

4

5

6

7

# Try our API. Copy & run this in your terminal.

curl -s --user 'api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0' \

https://api.mailgun.net/v3/samples.mailgun.org/messages \

-F from='Excited User <excited@samples.mailgun.org>' \

-F to='devs@mailgun.net' \

-F subject='Hello' \

-F text='Testing some Mailgun awesomeness!'

Ruby

开源项目:https://github.com/mailgun/mailgun-ruby

1

2

3

4

5

6

7

8

9

# Try running this locally.

def send_simple_message

RestClient.post "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0"\

"@api.mailgun.net/v3/samples.mailgun.org/messages",

:from => "Excited User <excited@samples.mailgun.org>",

:to => "devs@mailgun.net",

:subject => "Hello",

:text => "Testing some Mailgun awesomeness!"

end

Python

1

2

3

4

5

6

7

8

9

# Try running this locally.

def send_simple_message():

return requests.post(

"https://api.mailgun.net/v3/samples.mailgun.org/messages",

auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),

data={"from": "Excited User <excited@samples.mailgun.org>",

"to": ["devs@mailgun.net"],

"subject": "Hello",

"text": "Testing some Mailgun awesomeness!"})

PHP

开源项目:https://github.com/mailgun/mailgun-php

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

# Try running this locally.

# Include the Autoloader (see "Libraries" for install instructions)

require 'vendor/autoload.php';

use MailgunMailgun;

# Instantiate the client.

$mgClient = new Mailgun('key-3ax6xnjp29jd6fds4gc373sgvjxteol0');

$domain = "samples.mailgun.org";

# Make the call to the client.

$result = $mgClient->sendMessage("$domain",

array('from'=> 'Excited User <excited@samples.mailgun.org>',

'to'=> 'Mailgun Devs <devs@mailgun.net>',

'subject' => 'Hello',

'text'=> 'Testing some Mailgun awesomeness!'));

JAVA

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

# Try running this locally.

public static ClientResponse SendSimpleMessage() {

Client client = Client.create();

client.addFilter(new HTTPBasicAuthFilter(

"api","key-3ax6xnjp29jd6fds4gc373sgvjxteol0"));

WebResource webResource = client.resource(

"https://api.mailgun.net/v3/samples.mailgun.org/messages");

MultivaluedMapImpl formData = new MultivaluedMapImpl();

formData.add("from", "Excited User <excited@samples.mailgun.org>");

formData.add("to", "devs@mailgun.net");

formData.add("subject", "Hello");

formData.add("text", "Testing some Mailgun awesomeness!");

return webResource.type(MediaType.APPLICATION_FORM_URLENCODED).

post(ClientResponse.class, formData);

}

C

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

# Try running this locally.

public static RestResponse SendSimpleMessage() {

RestClient client = new RestClient();

client.BaseUrl = "https://api.mailgun.net/v3";

client.Authenticator = new HttpBasicAuthenticator(

"api","key-3ax6xnjp29jd6fds4gc373sgvjxteol0");

RestRequest request = new RestRequest();

request.AddParameter("domain",

"samples.mailgun.org", ParameterType.UrlSegment);

request.Resource = "{domain}/messages";

request.AddParameter("from", "Excited User <excited@samples.mailgun.org>");

request.AddParameter("to", "devs@mailgun.net");

request.AddParameter("subject", "Hello");

request.AddParameter("text", "Testing some Mailgun awesomeness!");

request.Method = Method.POST;

return client.Execute(request);

}

GO

参考开源项目:https://github.com/mailgun/mailgun-go

Nodejs

参考开源项目:https://github.com/mailgun/mailgun-js

推荐插件

WordPress

QQ邮箱拒收

网上有好多人吐槽发送给QQ邮箱的邮件直接被拒收。https://www.v2ex.com/t/331526

发送邮件时提醒如下:

1

ESP throttling: postmaster@mailgun.somecolor.cc → xxxxx@qq.com 'Hello ma' Server response: 550 Ip frequency limited. http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000725

产生原因

由于mailgun 共享IP发送给QQ邮箱的邮件太多。QQ邮箱直接全部拒收。而网易邮箱处理方式是直接进垃圾箱。

解决方案

  1. 买固定IP,然后向腾讯买IP白名单。
  2. QQ的邮箱直接使用其他服务发邮件(看下文其他免费服务)。
  3. mailgun 对于发送失败的邮件会自动重新发送,等到0点后,QQ就能收到邮件了。

其他同类服务

Amazon SES 免费套餐,月发送 62000 封电子邮件。

https://aws.amazon.com/cn/ses/pricing/

阿里云邮件推送服务,每个账户每日200封免费邮件。

https://www.aliyun.com/product/directmail?spm=5176.8064714.321187.pricedetail1111.MpRlp1

SendCloud 搜狐旗下付费服务

https://sendcloud.sohu.com

MandRill 付费服务

https://www.mandrill.com/pricing/

SendGrid 免费试用30天

30天试用,能免费发送40000封邮件

https://sendgrid.com

Postmark 免费试用

https://postmarkapp.com/pricing

本文参考文献:

https://www.v2ex.com/t/77558

http://www.tuicool.com/articles/mAFV7f

No related posts.


Original url: Access
Created at: 2020-01-09 12:34:21
Category: default
Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论