• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Setup CRAM-MD5 authentication for mailing in owncloud Ubuntu

November 22, 2013 by Sharad Chhetri Leave a Comment

In this tutorial we will learn about how to setup CRAM-MD5 authentication for mailing in Owncloud version 5.0.12-0 in Ubuntu.Today I found that while sharing the link in Owncloud the recipient was not getting email. It was quite obvious I have to set the Mailer. I read the online documentation from owncloud and tried to configure the mail.
I have setup the mail server which only authenticate CRAM-MD5. In Owncloud version 5.0.12 it has 3rd party application called PHPMailer which do not support the CRAM-MD5. The latest PHPMailer version 5.2 has CRAM-MD5 support feature.
In this post we are not using PHPMailer (I believe in next stable release of owncloud the latest PHPMailer will also be updated.)

Here we will use ssmtp . The ssmtp also works with google mail credentials.

Follow the steps to configure the ssmtp in Owncloud for CRAM-MD5 authentication

Step 1: In Ubuntu install the ssmtp


apt-get install ssmtp

Step 2: Configure the ssmtp. You must have the mail server and account details.

Replace:
noreply@example.com with your noreply email id
password-of-noreply means password of email account
mail.smtp.com:25 means mail server FQDN and 25 is port no. of SMTP protocol.

# cp -p /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.orig
# > /etc/ssmtp/ssmtp.conf

Vi /etc/ssmtp/ssmtp.conf

AuthUser=noreply@example.com
AuthPass=password-of-noreply
FromLineOverride=YES
mailhub=mail.smtp.com:25
UseSTARTTLS=YES
AuthMethod=CRAM-MD5

Step 3: Now edit Owncloud config.php . In my server the DircetoryRoot is /var/www/owncloud, replace the DirectoryRoot with the path of installed Owncloud.
Paste the below given contents just above the );

vi /var/www/owncloud/config/config.php

//Mail Server Setting //
 "mail_smtpmode"     => "ssmtp",
 "mail_smtphost"     => "mail.smtp.com",
 "mail_smtpport"     => 25,
 "mail_smtpauth"     => true,
 "mail_smtpauthtype" => "CRAM-MD5",
 "mail_smtpname"     => "noreply@example.com",
 "mail_smtppassword" => "Password",
 "mail_smtpsecure"   => 'tls',

Step 4: Login into owncloud,select some file ,click on sharing. Now share the link and give other email id of yours for testing.
In inbox you will see new email with shared link information. Now open the header of email. (In gmail it is known show original, some mail service provider have ‘Show Details’ tab)
In header you will see Return-Path as sharing-noreply@owncloud.Your-Server.Hostname eg. sharing-noreply@owncloud.sharadchhetri.com.

To change the Return-Path continue with further steps

Note: mail_domain was not working in config.php hence we are following given below steps

Step 5: Edit util.php file. (Take backup of util.php before editing)

cp -p /var/www/owncloud/lib/public/util.php /var/www/owncloud/lib/public/util.php.orig

vi /var/www/owncloud/lib/public/util.php

Note: Do the editing as stated below

In line no. 219 change the $hostname value to your domain(replace example.com)
And in line no. 228 replace example.com to your domain.

218         public static function getDefaultEmailAddress($user_part) {
219                 $host_name = 'example.com';
220                 $defaultEmailAddress = $user_part.'@'.$host_name;
221
222                 if (OC_Mail::ValidateAddress($defaultEmailAddress)) {
223                         return $defaultEmailAddress;
224                 }
225
226                 // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain'
227                 return $user_part.'@example.com';
228         }

Step 6: Now edit core/ajax/share.php

cp -p /var/www/owncloud/core/ajax/share.php /var/www/owncloud/core/ajax/share.php.orig

vi /var/www/owncloud/core/ajax/share.php

Edit the line. 108 and replace your-email-id with your email id ( you may be seeing here sharing-noreply)

108                         $default_from = OCPUtil::getDefaultEmailAddress('your-email-id');
109                         $from_address = OCPConfig::getUserValue($user, 'settings', 'email', $default_from );

Step 7: Now login into Owncloud. Select any file,click on share,now share the link and give your other email id for testing. Now open the inbox and check the header. The Return-Path should be now noreply@example.com (for eg. you configured noreply@yourdomain.com)

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Setup Owncloud 6 with self signed SSL certificate on Ubuntu 13.10
  2. Setup self signed ssl certificate on Owncloud 6 in Ubuntu 14.04 LTS Server
  3. In ESX , passwd: authentication information cannot be recovered
  4. RSA key authentication in Linux : Passwordless login
  5. How to configure vsftpd server with virtual user mysql authentication in CentOS 6
  6. Postfix + SES : SASL authentication failed
  7. How to install owncloud in Ubuntu 12.10
  8. Installing owncloud in Ubuntu 13.04
  9. How to configure self signed SSL certificate in owncloud Ubuntu
  10. How to install Owncloud 6 in Ubuntu 13.10 Server

Filed Under: Linux, owncloud

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Read the file inside compressed .gz files without extract

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

Terminal Recording with script and scriptreplay command

df command not showing correct free space in linux

How to encode and decode the strings with base64

How to page scroll up/down in Linux terminal

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy