Forums | Mahara Community
Support
/
cannot send emails
15 November 2011, 17:40
Hello all,
First off i would like to tell everyone I’m a beginner at this at best so ill try my best to give as much detail regarding my problem as i can and thank anyone who can help me up front.
I was able to install mahara on my 1and1.com host successful and everything seemed to work until i tried to register as a user and realized the emails are not going through.
I have created a cron job and assuming it works since the admin panel inside mahara says Cron: Running normally
I am using mahara's current version 1.4.1 and downloaded it 5 days ago from mahara.org
I have tried every suggestion on can find on almost every forum post here possible to fix this issue with no luck at the end.
I initially just updated the email setup section of mahara with my gmail smtp settings and that did not work.
then i tried inserting the mail code found in one of the tutorials straight into config.php and updating my smtp settings there ( that also did nothing )
// Mail handling
// If you want mahara to use SMTP servers to send mail, enter one or more here
// blank means mahara will use the default PHP method.
// $cfg->smtphosts = 'smtp.gmail.com';
// If smtp server uses port number different from 25 (e.g. for secure connections,
// port 465 is usually used with ssl, port 587 is usually used with tls),
// specify it below. Alternatively you may specify the port in smtphosts
// definition above using format [hostname:port] (e.g. 'smtp1.example.com:465').
// $cfg->smtpport = 465;
// If you have specified an smtp server above, and the server requires
// authentication, enter user credentials here:
// $cfg->smtpuser = '[email protected]';
// $cfg->smtppass = 'xxxxxxxx';
// If smtp server requres secure connection, specify the protocol type below.
// Valid options are '', 'ssl' or 'tls'. Setting it to '' or leaving the line
// commented means that secure connection will not be used.
// $cfg->smtpsecure = 'ssl';
I put a mail.php script into my mahara directory to see if an email would work and that did work.
<?php mail ( '[email protected]','testing email php','lets see if it
works!' ); ?>
I also found this code inside mahara but I don’t know where would I put this code into and if it would help or not
<?php
// example on using PHPMailer with GMAIL
include("class.phpmailer.php");
include("class.smtp.php"); // note, this is optional - gets called from main class if not already loaded
$mail = new PHPMailer();
$body = $mail->getFile('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "password"; // GMAIL password
$mail->From = "[email protected]";
$mail->FromName = "Webmaster";
$mail->Subject = "This is the subject";
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddReplyTo("[email protected]","Webmaster");
$mail->AddAttachment("/path/to/file.zip"); // attachment
$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment
$mail->AddAddress("[email protected]","First Last");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}
?>
Sorry for the long post but at this point i dont know what else i can do to make emails work on mahara
Please Help
Vick S.
15 November 2011, 18:55
Hi Vick,
Based on your mail.php test, it looks like your system's mail server is working fine so the problem must be in one of your Mahara mail server settings.
Can you attach your config.php (without all of the passwords of course!) here so that we can take a look and see if we can spot the problem?
Cheers,
Francois
15 November 2011, 19:13
This is what it looks like right now.
I can see there is nothing in there regarding email settings. I was using the admin page to upate my smtp settings.
At this point im clueless to what i should put where so thank you for your help
(((i ran a info.php on the root of mahara and noticed these settings for anything with the word mail in it :) i dont know if this would be helpful but just incase im pasting it here ..
sendmail_from | no value | no value |
sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i |
Path to sendmail /usr/sbin/sendmail -t -i
mail.force_extra_parameters | no value | no value |
)))))))
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
//
// MAHARA CONFIGURATION FILE
//
// Copy this file from config-dist.php to config.php, and change the values in
// it to suit your environment.
//
// Information about this file is available on the Mahara wiki:
// http://wiki.mahara.org/System_Administrator's_Guide/Installing_Mahara#Create_Mahara's_config.php
//
$cfg = new StdClass;
// database connection details
// valid values for dbtype are 'postgres8' and 'mysql5'
$cfg->dbtype = 'mysql5';
$cfg->dbhost = 'db39090xxx.db.1and1.com';
$cfg->dbport = '3306';
$cfg->dbname = 'db390xxxxx';
$cfg->dbuser = 'dbo390xxxx';
$cfg->dbpass = 'xxxxxx';
// Note: database prefix is NOT required, you don't need to set one except if
// you're installing Mahara into a database being shared with other
// applications (this happens most often on shared hosting)
$cfg->dbprefix = '';
// wwwroot - the web-visible path to your Mahara installation
// Normally, this is automatically detected - if it doesn't work for you
// then try specifying it here.
// This value must end with a /
//$cfg->wwwroot = 'http:// myhost.com/mahara/';
// If you want to serve all of your Mahara content via HTTPS, just set
// $cfg->wwwroot to use HTTPS.
//$cfg->wwwroot = 'https://myhost.com/mahara/';
// dataroot - uploaded files are stored here
// This is a ABSOLUTE FILESYSTEM PATH. This is NOT a URL.
// For example, valid paths are:
// * /home/user/maharadata
// * /var/lib/mahara
// * c:\maharadata
// INVALID paths:
// * ~/files
// * ../data
//
// This path must be writable by the webserver and outside document root (the
// place where the Mahara files like index.php have been installed).
// Mahara will NOT RUN if this is inside your document root, because
// this is a big security hole.
$cfg->dataroot = 'www.vm2001.com';
// If set, this email address will be displayed in the error message if a form
// submission is suspected of being spam. This reduces the frustration for the
// user in the event of a false positive.
$cfg->emailcontact = '[email protected]';
$cfg->log_environ_targets = 0;
// closing php tag intentionally omitted to prevent whitespace issues
15 November 2011, 21:13
Ok, can you paste in all of the settings (again, no passwords) that you have in the email section of the site options?
15 November 2011, 23:52
well i took another route lol and fixed it by wiping everything and reinstalling everything . The email function seems to be working fine but what is happening now that i dont know how to fix is that every link i click on ( once logged in as a user or admin) it asks me to enter my username and password again.
Any thoughts on this
Im using 1and1 hosting and dont think i have a Server Alias for my site . so the other reason stated in the faq is not having the correct rootpath .
so i put
echo getcwd(); on my index.php and this is what i get for the true rootdirector
/homepages/32/d386242648/htdocs/banksfindyou
previous to this i had it as $cfg->dataroot = 'banksfindyou' and this was working ,
but once i changed it to this /homepages/32/d386242648/htdocs/banksfindyou i got an error from mahara stating