Mail function doesnt work

ewoudwempe52

New Member
Messages
1
Reaction score
0
Points
0
When I try to mail, with php's mail function, no email is send, and it returns false. What can I do to solve this? Or is there another mail function?

Ewoud
 

descalzo

Grim Squeaker
Community Support
Messages
9,375
Reaction score
327
Points
83
I don't see you having a Free Hosting Account. Is this on an x10 server?
 

ebss85

New Member
Messages
1
Reaction score
0
Points
0
I am setting up a CMS and having a similar problem with user registration verification e-mails not being sent out. I am in the process of checking things at the CMS end, but if there is an issue with outgoing php mail then it would save me a lot of time if you could let me know.

Thanks

Oh hosting server is starka.
 
Last edited:

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
I am setting up a CMS and having a similar problem with user registration verification e-mails not being sent out. I am in the process of checking things at the CMS end, but if there is an issue with outgoing php mail then it would save me a lot of time if you could let me know.

Thanks

Oh hosting server is starka.

Do you receive a error ????
Is it Emails are sent (from the server) but never get to the user ????
Do you have a test Email scrip(PHP) that works ????
Can you add BC: to self ????

Tell us more and we can help you more
 

stef_63686

New Member
Messages
18
Reaction score
0
Points
0
Not sure how it works for X10 hosting but many (free) hosts disable the mail() function because it can easily be used for the wrong purposes.
If X10 allows mail(), read up on the mail function on php.net for example and be sure you did everything right, if the problem still persists, check for errors and chase them (post them here??), If you don't manage to fix it that way, mail() is probably disabled anyway
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
I have a PHP script to test PHP 'mail' function
load it onto my 'paid' account on server 'skyy' and it sends the Email
and I receive it

Load the same script onto my 'free' account on server 'boru'
while it throws NO errors the Email goes into the bit buckit
never to be seen again

Using webmail I can send and receive from server 'boru'
Using my Email client I can send and receive from server 'boru'

PHP init looks to be setup for 'sendmail'
 

garikr

New Member
Messages
46
Reaction score
0
Points
0
It works for we on boru with the following code:

$headers="From: auto@localhost.net"."\r\n"."X-Mailer: PHP/".phpversion();
$message=iconv("UTF-8","KOI8-R","А вот и рассылочка.....");

$check = mail( "aaaaaaa@list.ru",$message,$message,$headers );

echo $check;

as php manual says you MUST have 'From' header, it is not setup in php.ini on boru , there are also some restrictions regarding line length and encodings, read the manual.....

It worked for me without converting the message and the subject, except Russian was displayed as garbage
 
Last edited:

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
After weeks of NOT working this script works today...

PHP:
<?php
session_start();

$theto = 'toemail'; // change >toemail< to Email address that receives this mail

$theFrom = 'fromemail'; // change >fromemail< to Email address you are sending this Email from

$theSubject = 'Test ' . date("D M j,Y H:i:s T *I*",time());

$theMessage = 'Test from ' . $_SERVER[SCRIPT_URI] . "\r\nServer date and time " . date("D M j,Y H:i:s T *I*",time());

$additional_headers = 'From: ' . $theFrom . "\r\n" . 'Cc: ' . $theFrom . "\r\n" . 'Reply-To: ' . $theFrom . "\r\n";

// 'mail' can return TRUE and your mail still goes into the bit bucket
if (mail ($theto, $theSubject, $theMessage, $additional_headers))
  {
    // do your thing if 'mail' returns 'TRUE'
    print 'Message successfully sent ' . date("D M j,Y H:i:s T *I*",time()) . "<br>\n";
  }
  else
    {
      // do your thing if 'mail' returns 'FALSE'
      print 'Message delivery failed ' . date("D M j,Y H:i:s T *I*",time()) . "<br>\n";
    }
?>
When you are receiving errors in WebMail (RoundCube) this script will not work

Change the 'To' and 'From' Email address' and give it try - let us know how it works for you
 

ariasmac

New Member
Messages
29
Reaction score
0
Points
0
I´ll give it a try, thanks. I was looking for something like this.
 

kreator12

New Member
Messages
13
Reaction score
0
Points
0
If the mail function doesnt work, you should see the phpmailer class, and you can use your gmail or other email with pop3 accounts to send email with it :)
 
Top