[Email protected] ~]# echo 123|mail-s "123" [email protected]
[Email protected] ~]# smtp-server:530 5.7.0 must issue a STARTTLS command first. 71sm664699pfs.63-gsmtp
... message not sent.
QQ mailbox has been used to send their own e-mail, do data backup, today I want to change QQ mailbox Gmail mailbox, the results appear above the error, the Internet to find the next information finally resolved, but the pit more than halfway, summed up a convenient future encounter pit.
For ease of viewing, the input command is indicated in red, and Blue indicates what is entered
1. Add the following fields at the end of the/etc/postfix/main.cf file.
Smtp_sasl_security_options = noanonymous
Relayhost = [smtp.gmail.com]:587
Smtp_use_tls = yes
Smtp_sasl_auth_enable = yes
Smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
2. Configure SASL Certification
Create passwd file and add account password information
[smtp.gmail.com]:587 your e-mail: application-specific password
Note the ":" between the email account and the password, and don't miss out. For example: My company purchased Google Mail Service, I generated a password is 123qwe configuration [smtp.gmail.com]:587 [e-mail Protected]:123qwe
With Google's security restrictions, use a non-web-only way to set the app-specific password
Application-specific password generation Web site: https://security.google.com/settings/security/apppasswords
3. Change file permissions
4. Create a lookup table
5. Generate CA Certificate
Make your name. PEM #例如: My name is xiaoming, then make Xiaoming.pem
Umask 77; \
Pem1= '/bin/mktemp/tmp/openssl. XXXXXX '; \
Pem2= '/bin/mktemp/tmp/openssl. XXXXXX '; \
/usr/bin/openssl req-utf8-newkey rsa:2048-keyout $PEM 1-nodes-x509-days 365-out $PEM 2-set_serial 0; \
Cat $PEM 1 > Xiaoming.pem; \
echo "" >> Xiaoming.pem; \
Cat $PEM 2 >> Xiaoming.pem; \
Rm-f $PEM 1 $PEM 2
Generating a 2048 bit RSA private key
Writing new private key to '/tmp/openssl.ghsn9f '
You is about-to is asked to-enter information that'll be incorporated
into your certificate request.
What's about-to-enter is called a distinguished Name or a DN.
There is quite a few fields but can leave some blank
For some fields there would be a default value,
If you enter '. ', the field would be a left blank.
Country Name (2 letter code) [XX]:cn
State or province name (full name) :Beijing
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default company LTD]:gongsi
Organizational Unit Name (eg, section) :It
Common name (eg, your name or your server ' s hostname) :xiaoming
Email Address :[email protected]
7. Restart Postfix Service
8, testing, completion
Send the/etc/hosts file as an attachment to your Gmail mailbox.
echo "Mail Test" |mail-a/etc/hosts-s "hosts" [email protected]
This article is from the "meiyou" blog, make sure to keep this source http://324703.blog.51cto.com/314703/1732878
Use your Gmail mailbox to send mail under CentOS via Postfix