Upload
celso-crivelaro
View
112
Download
1
Embed Size (px)
Citation preview
O que devs precisam saber sobre envio de Emails
Celso CrivelaroGURU-SP
30 de Maio de 2015
O que devs precisam saber sobre envio de Emails
“O email não chega na caixa postal”
Cliente
Tipos de envio de Email
Email Pessoal
Email Transacional
Email Marketing
Como funciona o envio de emails?
SMTPSimple Mail Transfer Protocol
https://www.ietf.org/rfc/rfc2821.txt
https://tools.ietf.org/html/rfc821
S: 220 smtp.domain.com ESMTP PostfixC: HELO sender.example.orgS: 250 Helo sender.example.org, I am glad to meet youC: MAIL FROM: Bob <[email protected]>S: 250 OKC: RCPT TO:Alice <[email protected]>S: 250 OKC: DATAS: 354 End data with <CR><LF>.<LF><CR>
C: DATAS: 354 End data with <CR><LF>.<LF><CR>C: From: "Bob Example" <[email protected]>C: To: "Alice Example" <[email protected]>C: Cc: [email protected]: Date: Tue, 15 January 2008 16:02:43 -0500C: Subject: Test messageC: C: Hello Alice.C: This is a test message with 5 header fields and 4 lines in the message body.C: Your friend,C: BobC: .S: 250 Ok: queued as 12345C: QUITS: 221 Bye
Ruby StdLib: Net::SMTP
https://github.com/mikel/mail
Sender MTA MDA Receiver…
SMTPPOP
IMAP
DNS: Entrada MX
Bounce
Soft Bounces Hard Bounces
5.2.1 Mailbox disabled, not accepting messages
5.5.2 The recipient’s mailbox is full
5.5.3 Too many recipients
Pode retentar o envio Evitar a retentativa de envio
5.1.1 Bad destination mailbox address
5.6.1 Media not supported
5.1.2 Bad destination system address
http://tools.ietf.org/html/rfc3463
Payload
RETURN PATH
UNSUBSCRIBE
Multipart
“Todo e qualquer email enviado em massa sem a autorização do destinatário“
+85% dos Emails são SPAM
Fonte: Cisco Senderbasehttp://www.senderbase.org/static/spam/
Como sei que este remetente é verdadeiro?
SPF, DKIM, DMARC
Sender Policy Framework (SPF)
Sender Policy Framework (SPF)
DomainKeys Identified Mail (DKIM)
Domain-based Message Authentication, Reporting, and Conformance (DMARC)
https://engineering.groupon.com/2014/misc/dmarc-at-groupon/
Feedback Loop
Filtros AntiSpam
Provider - Sender
Provider
http://www.port25.com/list-of-current-feedback-loops-offered-at-isps/
Infraestrutura para envios massivos
Reputação de IP/Domínio
IP1
IP2
IP3
Receiver
IP1
IP2
IP3
example.org
malicious.org
Email Reputation
IP1
IP2
IP3
Receiver
IP1
IP2
IP3
example.org
malicious.org
!
!
Email Reputation
www.senderbase.org
www.senderbase.org
Envio aos provedores
IP1IP2
IP3
example.org
MTA
…
…
…
…
…
Boas Práticas
Usar serviços especializados
Relatórios
API
Contato com Provedores
Modelos de Email
NÃO COMPRE LISTA DE EMAILS
Double Opt-In
1. Captação 2. Confirmação
Multipart
Multipart usando ActionMailer
app/views/user_mailer
welcome_email.text.erb
welcome_email.html.erb
Oi <%= @user.name %>, bem vindo!
<div>Oi <strong><%= @user.name %></strong>, <br> Bem vindo!</div>
HTML / CSS são diferentes da web
Dúvidas?