O problema: determinados usuários fazem uso de um sistema e com ele gostariam de enviar e-mails, assim, agilizando o dia-a-dia. Mas o sistema em questão pede apenas dois parâmetros: IP do servidor SMTP + porta! Neste artigo mostrarei como resolvi esse problema utilizando um SMTP Relay Server.
[2] Comentário enviado por tsanches em 21/08/2010 - 15:28h
Bother tenho dúvidas.
Tipo, isso ele não limita X e-mails por dia/?
Ele dispara e-mails a vontade?
Tipo poderia criar um script de e-mail marketing, e mandar atrávés deste server?
Dahora seu artigo, muito bom, parabéns!!!
[3] Comentário enviado por removido em 27/10/2010 - 16:26h
Olá,
Fiz todos os passos e nao deu certo :-( ..... o que será que fiz errado? ...
/usr/lib/ssl/misc/CA.pl –newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
...............................++++++
.++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:BR
State or Province Name (full name) [Some-State]:Santa Catarina
Locality Name (eg, city) []:Santa Catarina
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Company X
Organizational Unit Name (eg, section) []:Student
Common Name (eg, YOUR name) []:Jurandir
Email Address []:ewb1.class@gmail.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:1234567
An optional company name []:1234567
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:1234567
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number:
f4:7a:17:78:77:6a:1d:c2
Validity
Not Before: Oct 27 19:57:53 2010 GMT
Not After : Oct 26 19:57:53 2013 GMT
Subject:
countryName = BR
stateOrProvinceName = Santa Catarina
organizationName = Company X
organizationalUnitName = Student
commonName = Jurandir
emailAddress = ewb1.class@gmail.com
X509v3 extensions:
X509v3 Subject Key Identifier:
D4:00:11:E4:BE:98:7F:D8:6F:89:15:AD:7F:A7:8F:32:1B:B2:75:FA
X509v3 Authority Key Identifier:
keyid:D4:00:11:E4:BE:98:7F:D8:6F:89:15:AD:7F:A7:8F:32:1B:B2:75:FA
DirName:/C=BR/ST=Santa Catarina/O=Company X/OU=Student/CN=Jurandir/emailAddress=ewb1.class@gmail.com
serial:F4:7A:17:78:77:6A:1D:C2
X509v3 Basic Constraints:
CA:TRUE
Certificate is to be certified until Oct 26 19:57:53 2013 GMT (1095 days)
Write out database with 1 new entries
openssl req -new -nodes -subj '/CN= Company X/O=Apelido EMPRESA/C=BR/ST= Santa Catarina/L= Santa Catarina/emailAddress=ewb1.class@mail.com' -keyout SERVER-key.pem -out SERVER-req.pem -days 3650
Generating a 1024 bit RSA private key
................++++++
.................++++++
writing new private key to 'SERVER-key.pem'
-----
openssl ca -out SERVER-cert.pem -infiles SERVER-req.pem
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature
Signature ok
The stateOrProvinceName field needed to be the same in the
CA certificate (Santa Catarina) and the request ( Santa Catarina)
# não use o nome de seu domínio em um servidor relay
mydestination = servnet1.localhost, localhost.localdomain, localhost
relayhost =
transport_maps = hash:/etc/postfix/transport
# coloque a range de ip usada em sua rede
mynetworks = 127.0.0.0/8 192.168.1.20/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#
## SASL Settings
#This is going in to THIS server
smtpd_sasl_auth_enable = no
# usei essa opção para o postfix não pedir senha ao meu sistema!!!
smtp_auth_enable = no
# We need this
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtpd_sasl_application_name = smtpdinet_protocols = ipv4
/etc/postfix# cat > /etc/postfix/transport
#
# Relay de emails para o Gmail
* smtp:[smtp.gmail.com]:587
/etc/postfix# cat > sasl_passwd
# Caso use Gmail
#[smtp.gmail.com]:587 usuario@seudominio.com.br:senha
#
# Caso tenha seu domínio no Google Apps
[smtp.gmail.com]:587 ewb1.gmail@gmail.com:1234567=
telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Hello there.
quit
+OK Better luck next time.
Connection closed by foreign host.
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 servnet2.localhost ESMTP Postfix (Debian/GNU)
quit
221 2.0.0 Bye
Connection closed by foreign host.
tail -f /var/log/mail.log
Oct 27 17:14:30 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Oct 27 17:15:30 debian postfix/trivial-rewrite[23440]: fatal: open database /etc/postfix/transport.db: No such file or directory
Oct 27 17:15:31 debian postfix/master[22629]: warning: process /usr/lib/postfix/trivial-rewrite pid 23440 exit status 1
Oct 27 17:15:31 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Oct 27 17:16:31 debian postfix/trivial-rewrite[23442]: fatal: open database /etc/postfix/transport.db: No such file or directory
Oct 27 17:16:32 debian postfix/master[22629]: warning: process /usr/lib/postfix/trivial-rewrite pid 23442 exit status 1
Oct 27 17:16:32 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Oct 27 17:17:32 debian postfix/trivial-rewrite[23446]: fatal: open database /etc/postfix/transport.db: No such file or directory
Oct 27 17:17:33 debian postfix/master[22629]: warning: process /usr/lib/postfix/trivial-rewrite pid 23446 exit status 1
Oct 27 17:17:33 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup – throttling
Verificando e-mail na fila e envio:
postqueue -p ou
[4] Comentário enviado por gokden em 29/10/2010 - 16:05h
essex usa o comando postmap no arquivo transport da pasta /etc/postfix tbm que arruma
# postmap /etc/postfix/transport
Caro amigo
nao mata o programador nao coitadinho hehehe
eu trabalho com um ERP qui funciona da mesma maneira, e eu qui dou manutenção nessa parte de e-mail.
ai eu tive a idéia de mudar os e-mails da Locaweb, para o google Apps, porém o smto do google só manda e-mail por TLS ou SSL
e o Oracle 10g nao envia e-mail com esses protocolos
e a única solução pra mim era essa ai mesmo
vlwww
quando der, explica melhor sobre esses Certficados de Segurança :D
isso nao ficou claro para mim
[9] Comentário enviado por removido em 09/11/2010 - 18:02h
Ola
Tentei fazer o exemplo todo novamente... mas na 1a linha algo já nao esta ok...
Apaguei o arquivo "CA.pl" porque após executar "#/usr/lib/ssl/misc/CA.pl -newca" nao fazia nada
entao pensei que o arquivo acima estava danificado.... como poderia saber? ... estou aprendendo, entao apaguei..
Copiei o arquivo "CA.pl" de um colega que usa debain
[13] Comentário enviado por cbsistem em 16/08/2012 - 08:59h
Socorro..
Montei o servidor com contas locais, internas:
carlos@mail.intranet, mario@mail.intranet
conta externa no gmail
externo@gmail.com
relayhost =[smtp.gmail.com]:587
envio entre contas locais ... ok
envio para uma conta externa usando externo@gmail.com .... erro
detalhe o email esta ficanco na caixa do email externo externo@gmail.com
o gmail esta bloqueando dizendo que não é um email do gmail, esta identificado o nome do meu servidor no cabeçalho
[14] Comentário enviado por LunodeSouza em 16/08/2012 - 14:32h
[13] Comentário enviado por cbsistem em 16/08/2012 - 08:59h:
Socorro..
como posso dizer para minhas contas internas nao usarem o relay.
Caro cbsistem,
Acredito que vale a pena utilizar 2 instâncias do postfix, uma para o relay server outra para a config de servidor usando o host interno...
Faça o teste :D
[15] Comentário enviado por vauires em 26/01/2016 - 11:45h
[3] Comentário enviado por removido em 27/10/2010 - 16:26h
Olá,
Fiz todos os passos e nao deu certo :-( ..... o que será que fiz errado? ...
/usr/lib/ssl/misc/CA.pl –newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
...............................++++++
.++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:BR
State or Province Name (full name) [Some-State]:Santa Catarina
Locality Name (eg, city) []:Santa Catarina
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Company X
Organizational Unit Name (eg, section) []:Student
Common Name (eg, YOUR name) []:Jurandir
Email Address []:ewb1.class@gmail.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:1234567
An optional company name []:1234567
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:1234567
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number:
f4:7a:17:78:77:6a:1d:c2
Validity
Not Before: Oct 27 19:57:53 2010 GMT
Not After : Oct 26 19:57:53 2013 GMT
Subject:
countryName = BR
stateOrProvinceName = Santa Catarina
organizationName = Company X
organizationalUnitName = Student
commonName = Jurandir
emailAddress = ewb1.class@gmail.com
X509v3 extensions:
X509v3 Subject Key Identifier:
D4:00:11:E4:BE:98:7F:D8:6F:89:15:AD:7F:A7:8F:32:1B:B2:75:FA
X509v3 Authority Key Identifier:
keyid:D4:00:11:E4:BE:98:7F:D8:6F:89:15:AD:7F:A7:8F:32:1B:B2:75:FA
DirName:/C=BR/ST=Santa Catarina/O=Company X/OU=Student/CN=Jurandir/emailAddress=ewb1.class@gmail.com
serial:F4:7A:17:78:77:6A:1D:C2
X509v3 Basic Constraints:
CA:TRUE
Certificate is to be certified until Oct 26 19:57:53 2013 GMT (1095 days)
Write out database with 1 new entries
openssl req -new -nodes -subj '/CN= Company X/O=Apelido EMPRESA/C=BR/ST= Santa Catarina/L= Santa Catarina/emailAddress=ewb1.class@mail.com' -keyout SERVER-key.pem -out SERVER-req.pem -days 3650
Generating a 1024 bit RSA private key
................++++++
.................++++++
writing new private key to 'SERVER-key.pem'
-----
openssl ca -out SERVER-cert.pem -infiles SERVER-req.pem
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature
Signature ok
The stateOrProvinceName field needed to be the same in the
CA certificate (Santa Catarina) and the request ( Santa Catarina)
# não use o nome de seu domínio em um servidor relay
mydestination = servnet1.localhost, localhost.localdomain, localhost
relayhost =
transport_maps = hash:/etc/postfix/transport
# coloque a range de ip usada em sua rede
mynetworks = 127.0.0.0/8 192.168.1.20/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#
## SASL Settings
#This is going in to THIS server
smtpd_sasl_auth_enable = no
# usei essa opção para o postfix não pedir senha ao meu sistema!!!
smtp_auth_enable = no
# We need this
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtpd_sasl_application_name = smtpdinet_protocols = ipv4
/etc/postfix# cat > /etc/postfix/transport
#
# Relay de emails para o Gmail
* smtp:[smtp.gmail.com]:587
/etc/postfix# cat > sasl_passwd
# Caso use Gmail
#[smtp.gmail.com]:587 usuario@seudominio.com.br:senha
#
# Caso tenha seu domínio no Google Apps
[smtp.gmail.com]:587 ewb1.gmail@gmail.com:1234567=
telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Hello there.
quit
+OK Better luck next time.
Connection closed by foreign host.
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 servnet2.localhost ESMTP Postfix (Debian/GNU)
quit
221 2.0.0 Bye
Connection closed by foreign host.
tail -f /var/log/mail.log
Oct 27 17:14:30 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Oct 27 17:15:30 debian postfix/trivial-rewrite[23440]: fatal: open database /etc/postfix/transport.db: No such file or directory
Oct 27 17:15:31 debian postfix/master[22629]: warning: process /usr/lib/postfix/trivial-rewrite pid 23440 exit status 1
Oct 27 17:15:31 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Oct 27 17:16:31 debian postfix/trivial-rewrite[23442]: fatal: open database /etc/postfix/transport.db: No such file or directory
Oct 27 17:16:32 debian postfix/master[22629]: warning: process /usr/lib/postfix/trivial-rewrite pid 23442 exit status 1
Oct 27 17:16:32 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Oct 27 17:17:32 debian postfix/trivial-rewrite[23446]: fatal: open database /etc/postfix/transport.db: No such file or directory
Oct 27 17:17:33 debian postfix/master[22629]: warning: process /usr/lib/postfix/trivial-rewrite pid 23446 exit status 1
Oct 27 17:17:33 debian postfix/master[22629]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup – throttling
Verificando e-mail na fila e envio:
postqueue -p ou
mailq
Você viu o teste apresentado pelo autor?
Não acompanha nenhum log comprovando que isso funciona...
Com artigos desse tipo eu nem, perco meu tempo. Tem muito bbc com banca de nerd enviando lixo desse tipo.
Aproveito para sugerir ao Vol publicar somente artigos que acompanham alguma documentação comprovando o funcionamento, dessa forma, eles evitam o armazenamento de lixo em seus servidores.