0

I configured Postfix on a VPS to use a relay service to send mail.

My challenge is how to configure Alfresco to connect to Postfix to send mail?

It is not sending mails.

Below are the parameters in alfresco.global.propoerties:

mail.host=localhost #I initially used the VPS server IP address but mails are still not sent mail.port=465 [email protected] mail.password=xxxxxxxxx mail.smtp.auth=true # Set to true if Postfix requires authentication mail.smtp.starttls.enable=false # Set to true if using TLS mail.protocol=smtps mail.encoding=UTF-8 [email protected] mail.smtp.auth=true 

Am I doing something wrong?

Below is the Postfix Main.cf:

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = smtp.gmail.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = $myhostname relayhost = [smtp.gmail.com]:465 smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_use_tls = yes smtp_tls_security_level = encrypt smtp_tls_wrappermode = yes smtp_tls_note_starttls_offer = yes mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all 
2
  • 1
    Is Alfresco running on the same macine? Why do you use smtp.gmail.com as hostname? Why do you specify username as a gmail address on your own mail server? How is sasl authentication configured? Commented Aug 16 at 19:36
  • Alfresco is running on the same VPS server where Postfix is installed. I used rgmail as relay host. Also I tested the mail sending on Postfix and it sent me mail. SASL has [smtp.gmail.com]:465 username:password in it. Some tutorilas i read said to specify the details of the mail server you want to use as relayhost in hostname. Commented Aug 16 at 20:27

1 Answer 1

2

myhostname = smtp.gmail.com and mydestination = $myhostname are incorrect. Your Postfix must identify as your server, not Gmail, and a relay‑only host should not claim any local destinations.

Fix Postfix to be a null client that relays everything to Gmail:

# main.cf myhostname = vps.yourdomain.com mydestination = mynetworks = 127.0.0.0/8 [::1]/128 relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_use_tls = yes smtp_tls_security_level = encrypt smtp_tls_wrappermode = no 

sasl_passwd:

[smtp.gmail.com]:587 [email protected]:APP_PASSWORD 

Then postmap /etc/postfix/sasl_passwd && chmod 600 /etc/postfix/sasl_passwd* && systemctl reload postfix.

Now point Alfresco at the local Postfix, not at Gmail, and don’t use SMTPS:

# alfresco-global.properties mail.host=127.0.0.1 mail.port=25 mail.protocol=smtp mail.smtp.auth=false mail.smtp.starttls.enable=false [email protected] mail.encoding=UTF-8 mail.debug=true 

If you really want to use 587 from Alfresco to Postfix, first enable the submission service with STARTTLS in master.cf; otherwise stick with localhost:25.

Also note: Gmail will only relay mail with a From address it accepts. Use your Gmail identity or a “Send mail as” alias you have verified, or configure smtp_generic_maps to rewrite From if needed.

5
  • Thank you fr your guidance. Very much appreciate It. I did as you directed but still Alfresco did not send notification mail. Below are my main.cf myhostname = ecm.seaicotechnologies.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases # myorigin = /etc/mailname mydestination = relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_use_tls = yes smtp_tls_security_level = encrypt smtp_tls_wrappermode = no mynetworks = 127.0.0.0/8 [::1]/128 Commented Aug 18 at 0:54
  • # Alfresco.global.properties # Outbound Email Configuration #------------- mail.host=127.0.0.1 mail.port=25 mail.protocol=smtp mail.smtp.auth=false mail.smtp.starttls.enable=false [email protected] mail.encoding=UTF-8 mail.debug=true Commented Aug 18 at 0:55
  • Your configs are basically correct now. The failure is almost always one of three things: Postfix cannot relay to Gmail, Postfix is not actually listening on 25 for the app, or Alfresco is not loading your properties. Commented Aug 18 at 5:10
  • Thanks. I checked and Postfix is running on Port 25. But what could cause Postfix not being able to relay to gmail? Because i did a test and it delivered the mail to my gmail. Also how can i check if Alfresco is not loading properties? Commented Aug 18 at 12:41
  • Since sendmail -v delivered, Postfix to Gmail is fine. If it had failed, typical causes are wrong app password, 465 vs 587 TLS mismatch, missing CA bundle, or 587 blocked. Next, verify Alfresco loads your props: set mail.debug=true, restart, trigger a reset/invite, and watch alfresco.log or catalina.out. You should see JavaMail connect to 127.0.0.1:25. If there’s no JavaMail output, alfresco-global.properties isn’t being read or is shadowed. Check tomcat/shared/classes, and try mail.host=badhost to force an error. Commented Aug 20 at 14:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.