smtpAuthLogin(dsocket *sd, const char *user, const char *pass)
{
int retval = 0;
dstrbuf *data;
dstrbuf *rbuf = DSB_NEW;
data = mimeB64EncodeString((u_char *)user, strlen(user), false);
if (writeResponse(sd, "AUTH LOGIN %s\r\n", data->str) < 0) {
smtpSetErr("Socket write error: smtp_auth_login");
retval = ERROR;
goto end;
}
#ifdef DEBUG_SMTP
printf("--> AUTH LOGIN\n");
fflush(stdout);
#endif
retval = readResponse(sd, rbuf);
if (retval != 334) {
if (retval != ERROR) {
smtpSetErr(rbuf->str);
}
retval = ERROR;
goto end;
}
#ifdef DEBUG_SMTP
printf("<-- %s\n", rbuf->str);
fflush(stdout);
#endif
/* Encode the password */
dsbDestroy(data);
將
AUTH LOGIN %s
拆成兩個動作,以兩次的command 來回,就可以解決這個問題了- Client does not have permission to Send As this sender
- SmtpClient 身份验证失败(authentication failed) 的原因分析
- email-3.1.2 ( smtpcommands.c )
沒有留言:
張貼留言