简体   繁体   中英

How to use user name and password in AUTH PLAIN?

I am trying to send Email using telnet and smtp.mail.yahoo.com server. when I try to authenticate myself on server using my yahoo mail ID and password. the server gave me Error;

501 malformed auth input (#5.5.4)

I am using AUTH PLAIN mechanism. I don't know how to combine user name and password. And after that convert it to base64 and then send.

Can somebody suggest me how to combine user name and password for AUTH PLAIN? Thanks

With AUTH PLAIN, the credentials should be sent according to this grammar (from RFC 4616 ):

message   = [authzid] UTF8NUL authcid UTF8NUL passwd
authcid   = 1*SAFE ; MUST accept up to 255 octets
authzid   = 1*SAFE ; MUST accept up to 255 octets
passwd    = 1*SAFE ; MUST accept up to 255 octets
UTF8NUL   = %x00 ; UTF-8 encoded NUL character
[...]

It seems common to have an empty authzid for SMTP servers, thus this should compute a working AUTH PLAIN message for you:

echo -ne "\0username\0password"|base64

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM