问题
I am getting this error in Joomla while sending the mail.
I am not getting this error every time. But some times its shows me "cannot initiate mail function".
Any solution for this?
回答1:
That could be any number of things, but a general list of things to check would be first, your Joomla config:
Admin panel > Global Configuration > Server > Mail Settings > Mailer
Make sure that's set to use the PHP mail function. If it is, try making a script called test.php and putting it in the root of your site (where the index.php file is for Joomla). Make that file something like this:
<?php
$to = "you@youremailaddress.com";
if( mail( $to , 'This is a test message.' , 'Is this working?' ) ) {
echo 'Email sent.';
} else {
echo 'Email failed to send.';
}
?>
Make sure you change the $to = line to your email address. Now go to that script: http://www.yourjoomlasite.com/test.php You should see the text 'Email sent.' in your browser and then receive an email to that address you entered. If not, then you should contact your hosting provider and ask them to upgrade to the latest PHP version and/or resolve the mail() function issue for you. That is the most raw implementation of sending mail via PHP and if that fails to work then it's got to be an issue with your host.
回答2:
If you are working in the local server, the mail will not initiate. So host your website in server and try it.
If you have any questions, let me know
回答3:
If you are using WAMP or similar on your own machine and are getting this message then you need to install a mail server. This is the best solution on Windows.
http://www.toolheap.com/test-mail-server-tool/
来源:https://stackoverflow.com/questions/7011622/cannot-initiate-mail-function-in-joomla