2013-06-19 9 views
3

저는 집에 고정 IP가있는 서버가 있습니다. 도메인으로 내 웹 페이지를 서비스하며 정상적으로 작동합니다.메일 서버 및 nodejs를 사용하여 서버에서 전자 메일을 보내는 방법

내 웹 페이지에 이메일 및 비밀번호로 등록 할 수 있습니다. nodemailer라는 노드 모듈을 등록 할 때 Google 계정에서 이메일을 보내면 문제는 Google 계정에 보낸 이메일의 한도가 있다는 것입니다.

그래서 내 집에있는 서버에 nodemailer 모듈을 연결해야합니다.

Google에서 검색하지만 비슷한 답변은 없습니다.

nodejs와 함께 postfix를 사용하는 방법 ??

http://www.postfix.org/

는 또는

https://github.com/baudehlo/Haraka

그래서 난 내 질문을 반복 nodemailer와 haraka 모듈을 사용하는 방법, 내 웹에 등록 이메일 사용자에게 내 서버에서 이메일을 보낼 필요가 . 예를 들어

...

사용자가 내 웹에 등록 [email protected]

nodemailer 구성은 ...

exports.newRegistration=function(parametros,callback) 
{ 
    var mailOptions = 
    { 
     from: "<[email protected]>",//my email 
     to: parametros.useremail,//user email 
     subject: 'Welcome '+parametros.useremail+'.', 
     html: '<br><b>Hello</b><br>'+ // html 

    }; 
    var smtpTransport = nodemailer.createTransport("SMTP", 
    { 
     service: "Gmail", 
     secureConnection: true, 
     auth: 
     { 
      user: "[email protected]", 
      pass: "7ftera359c28a", 
     }, 
    }); 
    smtpTransport.sendMail(mailOptions, function(err, response) 
    { 
     if(err) 
     { 
      smtpTransport.close(); 
      console.warn(err); 
      return callback(err,null); 
     }else{ 
      smtpTransport.close(); 
      return callback(null,response); 
     } 
    }); 
} 

이메일 확인을 보내지 만, 그것은 한계가있다 하루에.

그래서 난 TNX

편집 2

내가 가진 mailutils 설치 .... 제한이 내 이메일을 보내 이메일 서버를 사용할 필요가

을 적절를-얻고 지금은

시도
mail [email protected] 
Cc: // press enter 
Subject: Welcome 

Hello Mail. 

// Ctrl+D 

이 내 사서함에 이메일을 보내고 내가 이메일 [email protected]에서 보낸 스팸 메일에 수신

...

때문에, 후위 노력하고 있습니다,하지만, 난 여전히 emailjs 또는 nodemailer와 이메일을 보낼 수 없습니다

나는 내가에서 검색이

smtp: '535 5.7.8 Error: authentication failed: generic failure\n' 

을받을 이메일이나 nodemailer으로 이메일을 보내려고

Google에 오류가 있으며 인증 로그인 오류가 발생했습니다. 시스템에 로그인 할 수 없습니다. 그래서이 로그 파일

Jun 20 15:50:16 myname postfix/smtpd[12528]: warning: localhost[127.0.0.1]:    SASL login authentication failed: another step is needed in authentication 

이다 내가 다시

220 mydomain.com ESMTP Postfix (Ubuntu) 
ehlo localhost 
250-mydomain.com 
250-PIPELINING 
250-SIZE 10240000 
250-VRFY 
250-ETRN 
250-STARTTLS 
250-AUTH PLAIN LOGIN 
250-AUTH=PLAIN LOGIN 
250-ENHANCEDSTATUSCODES 
250-8BITMIME 
250 DSN 
AUTH LOGIN 
334 VXNlcm5hbWU6 
UbuntuUser 
535 5.7.8 Error: authentication failed: another step is needed in authentication 

을 시도하고 다시 루트

220 mydomain.com ESMTP Postfix (Ubuntu) 
ehlo localhost 
250-mydomain.com 
250-PIPELINING 
250-SIZE 10240000 
250-VRFY 
250-ETRN 
250-STARTTLS 
250-AUTH PLAIN LOGIN 
250-AUTH=PLAIN LOGIN 
250-ENHANCEDSTATUSCODES 
250-8BITMIME 
250 DSN 
auth login 
334 VXNlcm5hbWU6 
root 
334 UGFzc3dvcmQ6 
rootPassword 
535 5.7.8 Error: authentication failed: another step is needed in authentication 

로 텔넷

telnet localhost 25 
ehlo localhost 
250-mydomain.com 
250-PIPELINING 
250-SIZE 10240000 
250-VRFY 
250-ETRN 
250-STARTTLS 
250-AUTH PLAIN LOGIN 
250-AUTH=PLAIN LOGIN 
250-ENHANCEDSTATUSCODES 
250-8BITMIME 
250 DSN 
mail to: [email protected] 
501 5.5.4 Syntax: MAIL FROM:<address> 
mail from: [email protected] 
250 2.1.0 Ok 
rcpt to: [email protected] 
451 4.3.0 <[email protected]>: Temporary lookup failure 
data 
554 5.5.1 Error: no valid recipients 
AUTH LOGIN 
503 5.5.1 Error: MAIL transaction in progress 

으로 시도하고 그게 다에요. .. 프로는 어디 있습니까? 이것에서 흠집 ???

답변

6

나는이 작업을 수행해야했지만 Azure 가상 Ubuntu Linux 서버에서 노드 서버를 실행하고 있습니다. 우분투를 실행하는 경우 홈 서버에서 동일한 단계가 작동한다고 상상해보십시오. 여기에 내가 일을 발견 것입니다 :

나는이 가이드를 사용하여 후위 전자 메일 서버 설치 :

https://help.ubuntu.com/community/Postfix

그것은 처음에 많은 일처럼 보였다, 그러나 그것은 아주 쉽게 날 위해 일했습니다.

http://github.com/eleith/emailjs.git

나는 종종 보낸 이메일이 스팸으로 표시되고 결국 발견 :

나는 emailjs를 사용하는 것이었다 Node.js를에서 보내는 전자 메일을 보내는 가장 쉬운 방법을 발견했다. 이 문제를 방지하려면 도메인 이름을 관리하는 곳 (예 : enom을 사용)으로 이동 한 다음 SPF 레코드를 구성하여 보내는 전자 메일을 합법적으로 보이게 만들 수 있습니다. 내가 sasldb2 일부 사용자를 추가하고

var email = require("emailjs"); 

    postfixSend = function postfixSend(emailInfo, callback) { 

     var server = email.server.connect({ 
      user: "yourEmailAccountUser", 
      password: "yourPassword", 
      host: "localhost", 
      ssl:  false 
     }); 

     server.send({ 
      text: emailInfo.msg, 
      from: emailInfo.from, 
      to:  emailInfo.to, 
      subject: emailInfo.subject 
      }, function(err, message) { 
       callback(err); 
     }); 

    } 

    exports.postfixSend = postfixSend; 
+0

좋아, 내가 오류가이 메신저 .... 내가이 순간 – andrescabana86

+0

에 노력하겠습니다을 찾고 무엇을 생각 : {[오류 : authorization.failed] 코드 : 3, 이전 : {[오류 : 'N2Z0ZXJhMzU5YzI4YQ =='] code : 2, smtp : '535 5.7.8 오류 : 인증 실패 : 일반 오류 \ n'}, smtp : undefined} – andrescabana86

1

내가 이것에 드 문제를 해결 ...

article using postfix

: 여기

는 emailjs를 사용하여 이메일을 보낼 내 Node.js를 모듈입니다 emailjs 꽤 잘 작동합니다. 우선

Svbaker tutorial하지만, 대신에 다음 행을 추가

편집 /etc/postfix/sasl/smtpd.conf 사용하여 접미사 설치 :

pwcheck_method: auxprop 
auxprop_plugin: sasldb 
mech_list: PLAIN LOGIN 

thnx 모든 당신의 도움이 특별히을 @ Svbaker와 당신 에게이 문제에 대한 해결책을 제공합니다.

관련 문제