2015-01-07 4 views
0

OAuth 및 IMAP/SMTP를 통해 iOS 앱에서 Gmail이 작동합니다. SMTP가 작동하지 않더라도 다른 계정을 사용합니다. 맞춤 도메인 (Host Gator 사용) 및 outlook.com 계정으로 이메일 계정을 사용해 보았습니다. IMAP은 정상적으로 작동하지만 실패하는 것만 보입니다. 나는 연결 로거를 확인하고 얻을 수있는 다음 SMTP : 메시지를 보내는 중 오류가 발생했습니다.

event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 220 BLU436-SMTP189.smtp.hotmail.com Microsoft ESMTP MAIL Service, Version: 8.0.9200.16384 ready at Wed, 7 Jan 2015 04:03:35 -0800 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: EHLO -iPad 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 250-BLU436-SMTP189.smtp.hotmail.com Hello [80.194.198.170] 

250-TURN 

250-SIZE 41943040 

250-ETRN 

250-PIPELINING 

250-DSN 

250-ENHANCEDSTATUSCODES 

250-8bitmime 

250-BINARYMIME 

250-CHUNKING 

250-VRFY 

250-TLS 

250-STARTTLS 

250 OK 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: STARTTLS 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 220 2.0.0 SMTP server ready 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: EHLO -iPad 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 250-BLU436-SMTP189.smtp.hotmail.com Hello [80.194.198.170] 

250-TURN 

250-SIZE 41943040 

250-ETRN 

250-PIPELINING 

250-DSN 

250-ENHANCEDSTATUSCODES 

250-8bitmime 

250-BINARYMIME 

250-CHUNKING 

250-VRFY 

250-AUTH LOGIN PLAIN XOAUTH2 

250 OK 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 2 withData: AUTH PLAIN a21jZ3JhZHlAb3V0bG9vay5jb20Aa21jZ3JhZHlAb3V0bG9vay5jb20AQWZ0ZXJlZmZlY3RzMT8= 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 235 2.7.0 Authentication succeeded 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: MAIL FROM:<[email protected]> 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 250 2.1.0 [email protected] OK 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: RCPT TO:<[email protected]> 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 250 2.1.5 [email protected] 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: MAIL FROM:<[email protected]> SIZE=799 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 0 withData: 503 5.5.2 Sender already specified 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 
event logged:0x18141580 1 withData: QUIT 

event logged:0x18141580 -1 withData: 
event logged:0x18141580 -1 withData: 

내 SMTP 설정

은 다음과 같습니다

이메일

포트 (25) (도 587을 시도)

비밀번호

MCOConnectionTypeStartTLS (도 시도 MCOConnectionTypeTLS)

MCOAuthTypeSASLNone

sendOperationWithData에서

:이 코드는 전송하는 것입니다 Error Domain=MCOErrorDomain Code=30 "An error occured while sending the message."

: 나는 다음과 같은 오류 얻을

MCOAddress *address= [MCOAddress addressWithDisplayName:currentAccount.name mailbox:smtp_email]; 

MCOSMTPOperation * op = [currentSMTPSession checkAccountOperationWithFrom:address]; 
     [op start:^(NSError * error) { 

      } 

을 그리고는 다음과 같이 (송신 작업 전에라고도 함) SMTP를 구성합니다

if (currentSMTPSession == nil) { 
    currentSMTPSession = [[MCOSMTPSession alloc] init]; 
} 

[currentSMTPSession setHostname:currentAccount.smtp_server]; 
[currentSMTPSession setUsername:currentAccount.smtp_email]; 
[currentSMTPSession setPassword:currentAccount.smtp_password]; 
[currentSMTPSession setPort:currentAccount.smtp_port.intValue]; 
[currentSMTPSession setConnectionType:MCOConnectionTypeStartTLS]; 
[currentSMTPSession setOAuth2Token:currentAccount.oauthToken]; 
[currentSMTPSession setAuthType:MCOAuthTypeSASLNone] 
+1

-checkAccountOperationWithFrom : –

+0

현재'checkAccountOperationWithFrom :'''오류가 없다면'''sendOperationWithData'''를 호출 할 것입니다. checkAccount없이'''sendOperationWithData'''를 호출해야합니까? –

+0

예. 그게 내가 조언하는거야. –

답변

2

연결 유형에 문제가있었습니다. 내가 계정을 만들 때 MCONetService을 사용하여 반환 된 연결 유형을 저장하고있었습니다. 내 앞에 코드 기반으로 작업 한 사람이 SMTP 연결 유형 대신 IMAP 연결 유형을 저장하고있었습니다. 나는 이것을 바꿨고 이제는 효과가있다.

@ DinhVietHoá의 조언에 따라 checkAccountOperationWithForm:도 삭제했습니다.