Author Topic: Unable to Send E-mail, but I can receive E-mail  (Read 5266 times)

Offline craigmoore

  • Newbie
  • *
  • Posts: 6
Unable to Send E-mail, but I can receive E-mail
« on: June 04, 2007, 08:37:23 PM »
I've been reading through the forms and I can't find the solution to my problem. I wonder if someone could help me. I can log in and view my e-mails, but I'm unable to send them. My problem is that whenever I click send the animation appears saying it is "Sending the Message...", but fails to send the message and I'm left at the compose message page. From what I've read, I think this is a configuration issue regarding the SMTP server settings specifically regarding authorization. I've set-up my server using postfix, dovecot IMAP, and mySQL (see http://www.howtoforge.com/perfect_setup_fedora_core_4). This configuration requires server authorisation when sending e-mails. I have successfully used Mozilla Thunderbird to send and receive e-mails, here are the settings for that:

Incoming server settings:



Outgoing server settings:



The server name and username are identical in both incoming and outgoing.

On the RoundCube side of things I have the following configuration items that I've changed:

Code: [Select]
$rcmail_config['auto_create_user'] = TRUE;
$rcmail_config['default_host'] = 'xxx.xxx.xxx';
$rcmail_config['default_port'] = 143;
$rcmail_config['username_domain'] = '';
$rcmail_config['mail_domain'] = 'xxx.xxx.xxx';
$rcmail_config['virtuser_file'] = '';
$rcmail_config['virtuser_query'] = '';
$rcmail_config['smtp_server'] = 'xxx.xxx.xxx';
$rcmail_config['smtp_port'] = 25;
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$rcmail_config['smtp_auth_type'] = '';
$rcmail_config['smtp_log'] = TRUE;

I have tried all four of the different 'smtp_auth_type's listed, but none of them seem to make a difference when sending the e-mail. (I believe that the correct settings is PLAIN, since that is what I used when configuring postfix for this sever.)

Here is the output from the log file created in /var/www/mail.xxx.xxx.xxx/log/error.log :

Code: [Select]
[Mon Jun 04 18:20:18 2007] [error] [client xx.xx.xx.xx] File does not exist: /var/www/web6/web/favicon.ico
[Mon Jun 04 18:30:34 2007] [error] [client xx.xx.xx.xx] File does not exist: /var/www/web6/web/favicon.ico
[Mon Jun 04 18:41:34 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 19:13:06 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose&_reply_uid=1&_mbox=INBOX[/url]
[Mon Jun 04 19:18:42 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 19:26:03 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 19:30:05 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 19:33:23 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 23:18:59 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 23:35:39 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 23:44:14 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 23:51:42 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 23:52:12 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Mon Jun 04 23:57:25 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Tue Jun 05 00:05:28 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Tue Jun 05 00:34:07 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]
[Tue Jun 05 00:44:27 2007] [error] [client xx.xx.xx.xx] PHP Fatal error: Only variables can be passed by reference in /var/www/web6/web/program/steps/mail/sendmail.inc on line 336, referer: [url]http://mail.xxx.xxx.xxx/?_task=mail&_action=compose[/url]

It says something about only variables can be passed by reference? I'm wondering if this has something to do with the fact that the listing on my server for 'mail.xxx.xxx.xxx' is a link the folder titled 'web6'. This is a directory listing for /var/www

Code: [Select]
[root@xxx www]# pwd
/var/www
[root@xxx www]# dir -all
total 60
drwxr-xr-x 12 root    root 4096 Jun 4 23:36 .
drwxr-xr-x 25 root    root 4096 May 28 18:53 ..
drwxr-xr-x  2 root    root 4096 Jul 26 2006 cgi-bin
drwxr-xr-x  3 root    root 4096 May 27 22:58 error
drwxr-xr-x  2 root    root 4096 May 28 22:04 html
drwxr-xr-x  3 root    root 4096 May 27 23:52 icons
drwxr-xr-x  3 root    root 4096 May 30 00:30 localhost
lrwxrwxrwx  1 root    root  13 Jun 4 18:19 mail.xxx.xxx.xxx -> /var/www/web6
drwxr-xr-x 14 root    root 12288 May 27 23:55 manual
drwxr-xr-x  2 root    root 4096 May 28 19:33 sharedip
drwxr-xr-x  2 webalizer root 4096 Jun 2 12:31 usage
drwxr-xr-x  8 web5_xxx  web5 4096 Jun 4 19:01 web5
drwxr-xr-x  8 apache   web6 4096 Jun 4 18:19 web6
lrwxrwxrwx  1 root    root  13 May 29 21:01 [url]www.xxx.xxx.xxx[/url] -> /var/www/web5

Do you think this is the problem? Is there a way to remedy this within the code? This is the area that the error message is referring to (i.e. /var/www/web6/web/program/steps/mail/sendmail.inc on line 336)

Code: [Select]
// Begin SMTP Delivery Block
if (!$savedraft) {

 // send thru SMTP server using custom SMTP library
 if ($CONFIG['smtp_server'])
  {
  // generate list of recipients
  $a_recipients = array($mailto);

  if (strlen($headers['Cc']))
   $a_recipients[] = $headers['Cc'];
  if (strlen($headers['Bcc']))
   $a_recipients[] = $headers['Bcc'];

  // clean Bcc from header for recipients
  $send_headers = $headers;
  unset($send_headers['Bcc']);

  if (!empty($mb_subject))
   $send_headers['Subject'] = $mb_subject;

  // send message
  $smtp_response = array();
  $sent = smtp_mail($from, $a_recipients, $MAIL_MIME->txtHeaders($send_headers), $msg_body, $smtp_response);

  // log error
  if (!$sent)
   raise_error(array('code' => 800, 'type' => 'smtp', 'line' => __LINE__, 'file' => __FILE__,
            'message' => "SMTP error: ".join("\n", $smtp_response)), TRUE, FALSE);
  }

 // send mail using PHP's mail() function
 else
  {
  // unset some headers because they will be added by the mail() function
  $headers_enc = $MAIL_MIME->headers($headers);
  $headers_php = $MAIL_MIME->_headers;
  unset($headers_php['To'], $headers_php['Subject']);

  if (!empty($mb_subject))
   $headers_enc['Subject'] = $mb_subject;

  // reset stored headers and overwrite
  $MAIL_MIME->_headers = array();
  $header_str = $MAIL_MIME->txtHeaders($headers_php);

  if (ini_get('safe_mode'))
   $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str);
  else
   $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from");
  }


 // return to compose page if sending failed
 if (!$sent)
  {
  $OUTPUT->show_message("sendingfailed", 'error');
  $OUTPUT->send('iframe');
  return;
  }


 // set repliead flag
 if ($_SESSION['compose']['reply_uid'])
  $IMAP->set_flag($_SESSION['compose']['reply_uid'], 'ANSWERED');

 } // End of SMTP Delivery Block

Thanks in advance for any help you can provide.

Craig.

P.S. I manage my server using ISPConfig.

Offline craigmoore

  • Newbie
  • *
  • Posts: 6
Re: Unable to Send E-mail, but I can receive E-mail
« Reply #1 on: June 07, 2007, 07:24:24 AM »
Is there anyone that knows the solution? I could really use some help.

Offline Matelong2006

  • Newbie
  • *
  • Posts: 2
Re: Unable to Send E-mail, but I can receive E-mail
« Reply #2 on: June 07, 2007, 11:34:46 AM »
Me too, I can read mail but sending a composed mail results in "unable to send mail" etc. I use Microsoft's Windows Live Mail desktop and I can get all the mails from my server. I can also compose and send. A problem however, is that usually it asks the sender to verify that it's not a spam which may be problematic if it involves registrations as has happened with me severally where a reg should generate an 'activation email'. Any help will be appreciated.

Offline craigmoore

  • Newbie
  • *
  • Posts: 6
Problem Solved
« Reply #3 on: June 08, 2007, 11:21:30 AM »
I have discovered that the problem I was experiencing was due to the fact that I was running PHP in safe mode. This is option that can be selected when creating a new domain within my ISPConfig settings. To fix this problem, I deselected the 'PHP Safe Mode' option for my domain. If you want to learn more about ISPConfig, then go here: http://www.ispconfig.org. I do not know how to turn on/off PHP Safe Mode outside of ISPConfig, but I'm sure you can do a google to find out.

I also made the following changes to my ./config/main.inc.php file:

Code: [Select]
//Removed smpt server name in order to use the PHP mail() function instead.
$rcmail_config['smtp_server'] = '';

//Changed this to PLAIN from ''
$rcmail_config['smtp_auth_type'] = 'PLAIN';

If you are having trouble sending using RoundCube then I would make sure you are not running PHP in safe mode. Otherwise you will also experience the problems I was having.

Hope that helps,
Craig.