Use Gmail SMTP with Owncloud

21
March 3, 2014 at 1:09 pm  •  Posted in ownCloud by  •  21 Comments

People commonly have problems integrating Gmail with Owncloud. If you are not accustomed the technical Email vernacular, the settings can be overwhelming.

Add these lines to the end of the array in your config.php file. Make sure to update the username and password!

Keep in mind, you are adding this to a PHP array. If you choose to put these options somewhere else within the array, be sure to end the mail_smtppassword line with a comma.

Tags:

21 Comments

  1. grishnak / May 9, 2014 at 8:26 am / Reply

    Thanks for the tip, much appreciated!

    • Bl_nK / May 15, 2014 at 4:20 pm / Reply

      No problem!

  2. MEME / September 17, 2014 at 4:24 pm / Reply

    Is this the setup you are using for ownCloud Community Edition 7.x?

    • MEME / September 17, 2014 at 4:29 pm / Reply

      Are you removing the preset lines?

      ‘mail_smtpmode’ => ‘smtp’,
      ‘mail_smtpname’ => ‘support@domain.com’,
      ‘mail_smtpauthtype’ => ‘LOGIN’,
      ‘mail_from_address’ => ‘support’,
      ‘mail_domain’ => ‘domain.com’,
      ‘mail_smtpauth’ => true,
      ‘mail_smtphost’ => ‘smtp.gmail.com’,
      ‘mail_smtpport’ => ‘587’,
      ‘mail_smtpsecure’ => ‘tls’,
      ‘mail_smtppassword’ => ‘password’,

      • Bl_nK / September 18, 2014 at 7:58 am / Reply

        My posted configuration is all that is needed to work with Gmail. What kind of problems are you having?

    • Bl_nK / September 18, 2014 at 7:59 am / Reply

      This was setup using Owncloud 6. However, Owncloud 7 uses the same param names in the config file. Also, Owncloud 7 has a GUI to help set these up! http://doc.owncloud.org/server/7.0/admin_manual/configuration/configuration_mail.html

  3. MEME / September 18, 2014 at 8:04 am / Reply

    Oddly enough, I’ve tried using the gui. It gives me the above code and does not appear to be working as it kicks back an error.

    • MEME / September 18, 2014 at 9:05 am / Reply

      The same is true with your code pasted into the config.php and edited for values.

    • Bl_nK / September 18, 2014 at 12:10 pm / Reply

      What is the error? Also, can you post a little information about your server? Operating system and web server would be a good start!

      • MEME / September 18, 2014 at 12:27 pm / Reply

        A problem occurred while sending the e-mail. Please revisit your settings.

        • Bl_nK / September 18, 2014 at 12:35 pm / Reply

          Will need more information then that. OS and web server information could go a long way.

          • MEME / September 18, 2014 at 12:42 pm /

            ownCloud version: 7.0.2
            Apache version: 2.2.29
            PHP version: 5.4.32
            MySQL version: 5.5.37-35.1-log
            Operating system: linux
            Path to sendmail: /usr/sbin/sendmail
            Path to Perl: /usr/bin/perl
            Perl version: 5.10.1
            Kernel version: 3.4.91-20140518.1.ul6.x86_64

          • Bl_nK / September 18, 2014 at 12:46 pm /

            Based on the Kernel, I am assuming the distro you are using is Redhat or some derivative. Have you checked your SELinux Logs for problems?

          • MEME / September 18, 2014 at 1:05 pm /

            Shared hosting, hostmonster, calling them now for details.
            From the data directory/owncloud.log:

            {“reqId”:”541a04d421df4″,”app”:”mail”,”message”:”SMTP connect() failed.”,”level”:3,”time”:”2014-09-17T22:01:56+00:00″,”method”:”POST”,”url”:”\/clients\/index.php\/settings\/admin\/mailtest”}

          • MEME / September 18, 2014 at 1:42 pm /

            cent os 6.5, not seeing any errors today in the log…

          • Bl_nK / September 18, 2014 at 2:37 pm /

            Your error log says that there is an issue with SMTP connect. If you have shell access, I would try manually connecting to the SMTP server. Maybe even run tcpdump and watch for packets going to and from smtp.gmail.com. Also, make sure you have SMTP enabled in your Gmail account.

            Unfortunately, I don’t have much more to offer without being able to troubleshoot myself. Shared hosting works, but I have little experience with it. All of my Owncloud deployments occur on either VPS or hardware.

  4. Wayne Roberts / November 7, 2014 at 8:32 am / Reply

    Thanks, worked perfectly

  5. sudarjito / March 9, 2015 at 9:00 pm / Reply

    Hi, i’m using owncloud 8.0. Can you help me how to configure the email settings?
    I tried with sendmail, no message error but email/link never delivered.
    Then i tried with smtp, but always got error message ” A problem occurred while sending the email. Please revise your settings.”

    Thanks

    • sudarjito / March 9, 2015 at 9:01 pm / Reply

      FYI,
      I’m using Server Win 2008R2. Email with Googleapps

      Thanks

      • Bl_nK / March 13, 2015 at 10:39 pm / Reply

        Thanks for commenting!

        Unfortunately I have little to no experience with Windows. However, email configuration is fairly standard across platforms.

        If you are using smtp as your smtpmode, you will be using the PHP mailer. No need for sendmail.

  6. mustaqim / August 9, 2015 at 7:19 am / Reply

    hai , where to edit this SMTP email ?? someone help me .. for final project ..

Leave a Reply