Skết thúc with SMTP. or API¶

It’s up lớn you, whatever you find easier is fine with us. Here’s something to lớn consider:

Flexible with existing apps Faster (x3)
mở cửa protocol Assembly (don"t worry about MIME)
Scales better (Batch sending)

In short, SMTPhường. is an open and established protocol with large ecosystem, while API is better long term performance and maintenance wise.

Bạn đang xem: Mailgun là gì

curl -s --user 'api:YOUR_API_KEY' -F from='Excited User ' -F to=YOU
import;import com.mashape.unirest.http.HttpResponse;import com.mashape.unirest.http.JsonNode;import com.mashape.unirest.http.Unirest;import com.mashape.unirest.http.exceptions.UnirestException;public class MGSample // ... public static JsonNode sendSimpleMessage() throws UnirestException HttpResponseJsonNode> request ="" + YOUR_DOMAIN_NAME + "/messages") .basicAuth("api", API_KEY) .field("from", "Excited User ") .field("to", "artemis") .field("subject", "hello") .field("text", "testing") .asJson(); return request.getBody();
# Include the Autoloader (see "Libraries" for install instructions)require 'vendor/autoload.php';use;# Instantiate the client.$mgClient ='PRIVATE_API_KEY', 'https://API_HOSTNAME');$domain name = "YOUR_DOMAIN_NAME";$params = array( 'from' => 'Excited User ', 'to' => 'bob', 'subject' => 'Hello', 'text' => 'Testing some awesomness!');# Make the call lớn the client.$mgClient->messages()->send($domain, $params);
def send_simple_message(): return "", auth=("api", "YOUR_API_KEY"), data={"from": "Excited User ", "to": <"bar
using System;using System.IO;using RestSharp;using RestSharp.Authenticators;public class SendSimpleMessageChunk public static void Main (string<> args) Console.WriteLine (SendSimpleMessage ().Content.ToString ()); public static IRestResponse SendSimpleMessage () RestClient client = new RestClient (); client.BaseUrl = new Uri (""); client.Authenticator = new HttpBasicAuthenticator ("api", "YOUR_API_KEY"); RestRequest request = new RestRequest (); request.AddParameter ("domain", "YOUR_DOMAIN_NAME", ParameterType.UrlSegment); request.Resource = "domain/messages"; request.AddParameter ("from", "Excited User "); request.AddParameter ("to", "bar
YOUR_DOMAIN_NAME"); request.AddParameter ("subject", "Hello"); request.AddParameter ("text", "Testing some awesomness!"); request.Method = Method.POST; return client.Exexinh tươi (request);
import ( "context" "" "time")func SendSimpleMessage(domain name, apiKey string) (string, error) mg :=, apiKey) m := mg.NewMessage( "Excited User ", "Hello", "Testing some awesomeness!", "YOU
YOUR_DOMAIN_NAME", ) ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) defer cancel() _, id, err := mg.Send(ctx, m) return id, err
var API_KEY = 'YOUR_API_KEY';var DOMAIN = 'YOUR_DOMAIN_NAME';var = require('')(apiKey: API_KEY, domain: DOMAIN);const data = from: 'Excited User ', to: 'foo', subject: 'Hello', text: 'Testing some awesomeness!';, (error, body) => console.log(body););
NOTE: If you’re sending from our EU infrastructure, be sure lớn substitute our EU endpoint in the above example:

What actually happened: assembled a MIME message.Added the log entries lớn our full text search index.Delivered the tin nhắn.

You can find your private API key on your dashboard.

# Swaks is an smtp of CURL, install it first:curl -o swaks# Set the permissions for the script so you can run itchhack +x swaks# It's based on perl, so install perlsubởi vì apt-get -y install perl# now send!./swaks --auth --hệ thống --au postmaster
import*;import;import java.util.Properties;import java.util.Date;import javax.mail.*;import javax.mail.mạng internet.*;import com.sun.mail.smtp.*;public class MGSendSimpleSMTP public static void main(String args<>) throws Exception Properties props = System.getProperties(); props.put("", ""); props.put("mail.smtps.auth", "true"); Session session = Session.getInstance(props, null); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("YOU", false)); msg.setRecipients(Message.RecipientType.TO, addrs) msg.setSubject("Hello"); msg.setText("Testing some awesomness"); msg.setSentDate(new Date()); SMTPTransport t = (SMTPTransport) session.getTransport("smtps"); t.connect("", "postmaster
YOUR_DOMAIN_NAME", "YOUR_SMTP_PASSWORD"); t.sendMessage(msg, msg.getAllRecipients()); System.out.println("Response: " + t.getLastServerResponse()); t.close();
// Using Awesome 'PHPMailerAutoload.php';$mail = new PHPMailer;$mail->isSMTP(); // Set mailer to use SMTP$mail->Host = ''; // Specify main and backup SMTP. servers$mail->SMTPAuth = true; // Enable SMTP authentication$mail->Username = 'postmaster
YOUR_DOMAIN_NAME'; // SMTPhường. username$mail->Password = 'secret'; // SMTPhường password$mail->SMTPSecure = 'tls'; // Enable encryption, only 'tls' is accepted$mail->From = 'YOU'); // Add a recipient$mail->WordWrap = 50; // Set word wrap khổng lồ 50 characters$mail->Subject = 'Hello';$mail->Body = 'Testing some awesomness';if(!$mail->send()) emang đến 'Message could not be sent.'; emang lại 'Mailer Error: ' . $mail->ErrorInfo; else emang lại 'Message has been sent';
import smtplibfrom email.mime.text import MIMETextmsg = MIMEText('Testing some awesomness')msg<'Subject'> = "Hello"msg<'From'> = "foo
YOUR_DOMAIN_NAME', '3kh9umujora5')s.sendmail(msg<'From'>, msg<'To'>, msg.as_string())s.quit()
# install `mail` gem first: `gem install mail`require 'mail'Mail.defaults do delivery_method :smtp, :port => 587, :address => "", :user_name => "", :password => "", endmail = Mail.deliver vày to 'bar
YOUR_DOMAIN_NAME' subject 'Hello' text_part bởi toàn thân 'Testing some awesomness' endend
using System;using System.IO;using MailKit;using MailKit.Net.Smtp;using MimeKit;using RestSharp;using RestSharp.Authenticators;public class SmtpMessageChunk{ public static void Main (string<> args) SendMessageSmtp (); public static void SendMessageSmtp () // Compose a message MimeMessage mail = new MimeMessage (); mail.From.Add (new MailboxAddress ("Excited Admin", "foo
"Testing some awesomesauce!", ; // Sover it! using (var client = new SmtpClient ()) { // XXX - Should this be a little different? client.ServerCertificateValidationCallbachồng = (s, c, h, e) => true; client.Connect ("", 587, false); client.AuthenticationMechanisms.Remove sầu ("XOAUTH2"); client.Authenticate ("postmaster
import ( "")func main() e := gmail.NewEmail() e.From = "Your Name " e.To = <>string"bar" e.Subject = "Hello" e.Text = <>byte("Testing some awesomeness") err := e.Send("", smtp.PlainAuth("", "YOUR_USERNAME", "YOUR_PASSWORD", "")) if err != nil panic(err)

Verify Your Domain¶

Add a domain name you own & verify it by setting up the DNS records we provide (known as SPF & DKIM) at your DNS provider.


Why you need to verify your domain:

To prove sầu that you are an authorized sender for the domain name.Verified domains are not subject to lớn a sending limit of 300 emails per day.No more “sent via” message in your emails.Establishing a positive sầu tin nhắn reputation for your own tên miề is less suspicious of traffic that is being sent on verified domains and so using one reduces the likelihood of being disabled.

How to lớn verify your domain¶

Add your domain or subdomain name.mở cửa your DNS provider and add the two TXT DNS records provided.If you want lớn traông xã clicks & opens you can also add the CNAME record.MX records should also be added, unless you already have sầu MX records for your domain pointed at another gmail service provider (e.g. Gmail).

Xem thêm: Cty Cấp Nước Bến Thành (Hcm), Công Ty Cổ Phần Cấp Nước Bến Thành

Once you’ve sầu added the records and they’ve sầu propagated, your domain name will be verified.

If you will be creating a lot of domains, offers an API endpoint for adding/editing/removing domains from your account. See the Domains endpoint for more information.

Add Sending & Tracking DNS Records¶

TXT“v=spf1 ~all”SPF (Required)
TXTFind this record in your Control Panel, Domains TabDKIM (Required)
CNAME“”Tracking (Optional)


While the CNAME is listed as optional, it is required to lớn enable Unsubscribe and Cliông xã tracking liên kết.

Add Receiving MX Records¶

Mail server for handling inbound messages. MX Information

TypeValuePurpose (Optional) (Optional)


Do not configure Receiving MX DNS records if you already have another provider handling inboundmail delivery (e.g. Gmail).

Common DNS Providers¶

Common providers are listed below. If yours is not listed, tương tác your DNS provider for assistance.

GoDaddy: MX - CNAME - TXT

NameCheap: All Records

Network Solutions: MX - CNAME - TXT

Rackspace Thư điện tử & Apps: All Records

Rackspace Cloud DNS: Developer Guide

Amazon Route 53: Developer Guide

DigitalOcean: và DigitalOcean Guide

You are all set!

Read more about How to lớn start receiving inbound tin nhắn và How lớn start tracking tin nhắn events.

Nổ hũ club online uy tín
game đổi thưởng uy tín gamedoithuong88
SUNCITYVN | win79 | |