Log in

View Full Version : Need help in MAIL function



ahhiamdying4u
07-02-2006, 03:59 PM
Hi everybody. This is my first post & I am a PHP newbie. :p

Please someone help me here ...

It is from a form in my site where a user is recommending his friends about my site.
I want to save the emailIDs in mySql db & then send all of them a html message. Sequentially.
DB input is okay ... but no email is going.:(

What I did:


//The first part is all about inserting in sql db.
//Total php written in one big <? ... ?>

$to = $eml1 . ", " ; //note the comma
$to .= $eml2 . ", " ;
$to .= $eml3 . ", " ;
$to .= $eml4;

$subject = $usrnm . "has recommended SMILE to you";

$message = ’<html>
<head><title>smile-india.org.in</title></head>
<body>
...
...
</body>
</html>’;

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: <" . $usreml . ">\n";

/* and then mailed it */
mail($to, $subject, $message, $headers);

NO EMAIL IS GOING ... WHAT IS WRONG ??? :confused:
Should I use 'imap_mail' :eek:

Plz Help

djr33
07-02-2006, 10:13 PM
Some servers have the mail function disabled. Maybe that's the case with your host?

You could run a page with just:
<?php phpinfo(); ?>

and see what comes up.

That'll tell you all the details of what's going on, and should say if mail is disabled or not.


Check that first... I also looked at the script, and nothing jumped out as wrong, but that doesn't mean it's neccesarily right. We can check that later.

ahhiamdying4u
07-03-2006, 04:42 AM
While I run the phpinfo() in the server ...
The following statements about mailing came out ... what THEY mean ??? :confused:
[as I told, I am a php newbie]

http://img119.imageshack.us/img119/2718/ppp7ce.gif

That all nothing about php mail function.

WHAT THEY MEAN ??? :rolleyes:
SHOULD I POST THE FULL PHPINFO PAGE ??? :D

IS IT OK IF I MAKE THE MESSAGE BODY LIKE THIS:


/* message */
$body1 = "$v_name just recommended you to visit our site, with this message:\n$v_comm\n\n";
$body2 = '<html>
<head><title>smile - symphony for sympathy</title>
</head>
<body>
<table width="515" border="0" cellspacing="0" cellpadding="0">
...
...
</table>
</body></html>';

$message = $body1 . $body2;
..
..
mail($to, $subject, $message, $headers);

djr33
07-03-2006, 07:26 AM
Yeah, that's just fine... it's just simple ways in php to add different parts together.... shouldn't cause any trouble.


Not sure what that tells us... seems like it implies that mail works... if you could link to the phpinfo page (just a link is fine, no need to paste here), that might help more.

Twey
07-03-2006, 01:44 PM
WELL, DOES THE mail() FUNCTION RETURN TRUE OR FALSE???

THERE'S NO NEED TO SHOUT, BY THE WAY!!! OVERUSING PUNCTUATION IS A BIT DAFT TOO!!!

djr33
07-03-2006, 07:44 PM
Yeah, I guess that's the main question.
A link would be most helpful.