Failure when trying to connect to SMTP mail server

Hello everyone !

I have a kind of huge situation here...

I would like to configure my outbound SMTP mail server. i'm using Gmail for it.
So, i use "smtp.gmail.com" in SMTP server, i chose 587 as the smtp port, and i tried both SSL and TLS.
My gmail address and gmail password are correct.

But yet, when sending the test mail, i got this error message :"Erreur emailing :Failed to connect to outbound SMTP Mail Server"

I've search for the imap in Php5, and i do have IMAP enabled. I don't know what to do, and i'm totally confuse and at a dead end : i'll use the outbound a lot, and i need to receive email too !

I'm kind of in a hurry with a seems-to-be unresolvable mess.

Could you help me please ?

My configuration :
- SugarCRM Professional, Version 7.5.2.1 (Build 1008)
- PHP version 5.3.23
in php info, in "Configure command", i have "--with-imap-ssl", and in Protocol, i have imaps and imap.

Please, please help me !

Thanks a lot for your time !
  • First off all IMAP is not required to configure outbound email.Its required for inbound emails.
    Are you sure the authentication details you are giving is correct?
  • Hello,

    In Admin > System Settings, please update the Log Level to 'error'.  In Sugar 7.5.x we're capturing SMTP related errors at this level rather than the FATAL level.

    After making this change, click the Save button then reopen Admin > System Settings.  Scroll to the bottom of the page and click 'View Log'.  Click the 'Mark Point' button.  Retry the 'Send Test' option in Admin > Email Settings.

    When the email fails, click the 'Refresh from Mark' button on the 'Configurator' tab.  You should now have additional information regarding why the email failed to send.

    Typically with Google this occurs because of two-factor authentication.  There will likely be a link to a Google Knowledge Base article that explains the root cause and work-arounds for the issue you're encountering.

    Regards,

    Dan Kallish
    Advanced Support Engineer
    SUGARCRM

    Learning Resources: http://support.sugarcrm.com | http://university.sugarcrm.com | http://community.sugarcrm.com
  • Hi Gaelle,

    You may look into Allow access to your Google account and  Allowing less secure apps to access your account. Definitely give the first link a try by following it, logging into the Google account you are connecting to Sugar, and clicking Continue (more info at https://accounts.google.com/DisplayUnlockCaptcha). I don't recall if the second link (allowing less secure apps...) was required with Sugar or not, but it is best to avoid this option. It might server more as a troubleshooting step.

    Good luck!

    Jason
  • Well, at the end of it, i would like to use smtp to get inbound email and generate Cases from them. But i would like my team to send email as well.
    But in fact, i have this error when sending the test email in EmailMan config.(Admin,>Email parameters>SMTP configuration)
  • Thanks Dan, it is a trick we don't have knowledge to.
    Here are the generated logs :

    SMTP -> ERROR: Failed to connect to server. Code: 0 Reply: 
    MailerException - @(SmtpMailer.php:166 [6]) - Failed to connect to outbound SMTP Mail Server
    MailerException - @(SmtpMailer.php:166 [6]) - Failed to connect to outbound SMTP Mail Server

    So, i'm assuming that Mailer can't access to the smtp server from google ? or does it ?
  • Hi Jason,
    I've already allowed less secure apps to access my gmail account, but it did nothing. I now tried your first link too, but there was no change at all ...
    I re-checked my gmail credentials, and they are still good...

    I'll try again to find some gmail knowledge base.
    Thanks a lot :)
  • Hi Gaelle

    Try using SSL port 993, if this still doesn't work could you confirm if your hosted onsite or via a hosting provider in the cloud i had a similar case where in there were two problems the centos box preventing me from connecting to gmail (non php issues)
  • Okay, at least, the test email is working

    Dan Kallish helped me by giving me advices for logs. (traditionnally, i just open the sugarcrm.log and try to find something).

    And Jason Thiede was totally right : we have to allow access to the google account, but we DO need allowing less secure apps to access. My first try was doing it in chrome but my sugar was open on Firefox, therefore it did not work. But then, i allowed it via firefox and it does work now.

    Hopefully, i'm using gmail only for tests, because i don't know how we could allow access from every user's computer on chrome/ff/ie...

    Thanks to Shijin Krishna to, because well, sometimes we need some reminders.

    Problem Solved, and good luck with SMTP and Gmail !

    BUT i still have another problem with inbound emails. I'll open a new thread.

    Thanks a lot gentlemen !



  • Hi @EvilPeri, that could have been a good path to follow, but i've resolved this problem. now i'm focused on inbound emails and imap. By the way, i'm OnSite, no special hosting provider (vm in my network)
  • You are always welecome:)