Issue with email sending from share file

Ask all your questions regarding OC 4.x and older. Please read the Support Forum Rules
Forum rules
Before you post; make sure you are using at least PHP Version 5.3.x - Also read How To Solve Problems By Yourself

Re: Issue with email sending from share file

Postby agcmvp » Tue Jul 17, 2012 9:38 am

This is a solution that works for me (running Debian 6 with Apache 2.2 and PHP 5.3.3)
All you need is a way to send mails from your server and set up PHP to work with it.
The easiest solution I found is to install a package called ssmtp: http://linux.die.net/man/8/ssmtp
By this way you need an external smtp server to send mails (like Google's smtp.gmail.com:587).
Configure ssmtp to connect to smtp server and don't forget to set up php to use ssmtp (in /etc/php5/apache2/php.ini modify sendmail_path = /usr/sbin/ssmtp -t).

There are a lot of tutorials to do this through gmail and the logs are very useful.
Good luck!
agcmvp
Newbie
 
Posts: 2
Joined: Tue Jul 17, 2012 9:16 am

Re: Issue with email sending from share file

Postby RandolphCarter » Tue Jul 24, 2012 8:59 am

It seems that I had a slightly different issue than most people here (no mail was sent at all when trying to share a file, no matter which browser was used), but let me report my findings anyway, maybe someone has had a similar issue (or can at least rule out the possibilities described here).

For me, the root cause turned out to be that I didn't configure a user email address (and that the fallback address is determined in a way which doesn't work for my configuration).

But let me add a more detailed description on how I got to that conclusion for those having only a similar but not the same problem:
I first checked whether there is any logging concerning the mail functionality. There is, but log level has to be set to debug (i.e. there has to be a line
Code: Select all
 "loglevel" => "DEBUG",
in config.php).
Then I checked the log file (default location is in the data directory, the filename is owncloud.log).
It contained an entry like this:
Code: Select all
{"app":"mail","message":"Invalid address: sharing-noreply@mydomain.dom:nnnn","level":0,"time":1343xxxxxx}
(anonymized in places, i.e. nnnn and xxxxxx).
By looking at the code I found out, that as sender address, either the email address configured for the user is taken, or "noreply@yourhost". I use a non-standard port, and the port number is included in the used host name, which means that the resulting email address is invalid.

So, in short, it worked after configuring a user email address, but that can be hard to spot for normal users, because ther is no hint in that direction!

In my opinion a fix for every situation would be needed and also rather simple (beware, implementation details follow): use the SERVER_NAME instead of the HTTP_HOST for determining such email addresses...

In addition, in my opinion, there should be an appropriate error message and log entry if the email wasn't sent properly. At the moment, it said "Email sent", although nothing was actually sent!
RandolphCarter
Inventory
 
Posts: 2179
Joined: Wed May 30, 2012 7:42 am
OwnCloud version: 5.0.5
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.4.13

Re: Issue with email sending from share file

Postby nucleardirk » Sun Jul 29, 2012 8:17 pm

Still with 4.05 this issue appears (changelog said its fixed)
Any one else with problems?
nucleardirk
Newbie
 
Posts: 6
Joined: Thu May 31, 2012 5:33 pm

Re: Issue with email sending from share file

Postby nucleardirk » Tue Aug 07, 2012 10:25 pm

Still with 4.06 and diverse kind of browsers ;(
Nothing happend...
Last edited by nucleardirk on Thu Aug 09, 2012 1:12 pm, edited 1 time in total.
nucleardirk
Newbie
 
Posts: 6
Joined: Thu May 31, 2012 5:33 pm

Re: Issue with email sending from share file

Postby mccar75287 » Thu Aug 09, 2012 1:02 pm

I get a related but different error message when trying to share a link via email.
Error is "Could not execute: /var/qmail/bin/sendmail" on Win2008 R2 ownCloud 4.06

Any one got any idea's? Default config since I am not familiar with PHP or any of the scripts involved so I dont know where to look... :?:
mccar75287
Newbie
 
Posts: 8
Joined: Wed Jun 27, 2012 11:26 am

Re: Issue with email sending from share file

Postby litbea » Fri Jan 18, 2013 9:20 pm

Good! Changing the port worked for me!!

rocketledger wrote:Here is a solution that worked for me. I am using gmail as the relay. Google uses port 587 and TLS encryption and these need to be set in addition to the other SMTP parameters you have listed above in your config.php file. Your particular port number and encryption may be different depending on the SMTP provider or mail server.

Here is the tricky part. Currently, there does not appear to be a way to set these parameters in the config.php file. Therefore, you need to dig into the code and hard code these in the /3rdparty/class.phpmailer.php file. The default port is set at 25 and encryption is defaulted to nothing. Set these along with your parameters in the config.php file and your issues may be resolved. The variables to set are around line 190 in the code at /3rdparty/class.phpmailer.php

Code: Select all
 
 /**
   * Sets the default SMTP server port.
   * @var int
   */
  public $Port          = 587;


and,

Code: Select all
  /**
   * Sets connection prefix.
   * Options are "", "ssl" or "tls"
   * @var string
   */
  public $SMTPSecure    = 'tls';



Someone else may know if there is a way to set these variables in the config.php file, but in the meantime, this might help someone trying to set up SMTP through gmail.
litbea
Newbie
 
Posts: 9
Joined: Fri Jan 11, 2013 11:51 am

Re: Issue with email sending from share file

Postby nky1986 » Wed Jan 30, 2013 2:29 pm

Hi,
I am also facing some issue with sending mail on sharing the link.

I am using ownCloud 4.5.5.

I changed the core/ajax/share.php file

from
$default_from = 'sharing-noreply@' . $server_host;
to
$default_from = '<name>@<my-company-name>.com';

when i am sharing a file with link then, i typed the email address of reciever

i checked the log

{"app":"mail","message":"Mail from admin (<name>@<my-company-name>.com) to: <name>@<my-company-name>.com(<name>@<my-company-name>.com) subject: User admin shared a file with you","level":0,"time":1359551730}


but i am not receiving any file

what could be the issue

Thanks.
nky1986
Newbie
 
Posts: 2
Joined: Wed Jan 30, 2013 2:24 pm
OwnCloud version: 4.5.3

Re: Issue with email sending from share file

Postby nky1986 » Wed Jan 30, 2013 2:39 pm

Hi,
I meant to say, i am not receiving any mail
nky1986
Newbie
 
Posts: 2
Joined: Wed Jan 30, 2013 2:24 pm
OwnCloud version: 4.5.3

Re: Issue with email sending from share file

Postby mrstaun » Wed Feb 13, 2013 11:02 am

gfleischbein wrote:I have added the following to the config.php

"mail_smtpmode" => 'smtp',
"mail_smtphost" => 'local.smtp.server',
"mail_smtpauth" => false,
.


and voila - everything works like a charm for me - both on a Ubuntu 12.04 and Windows 2008 R2 platform with Owncloud 4.5.6
mrstaun
Newbie
 
Posts: 8
Joined: Wed Feb 13, 2013 10:58 am
OwnCloud version: 4.5.6

Previous

Return to OwnCloud Community Edition 4.x and older

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 26 guests