jackson5759 Posted December 12, 2006 Share Posted December 12, 2006 i got a script.. inside got a function used to ''invite your friends''but when i key in email address, and sent the mail, my friend still cannot receive my email..i want to ask here.. am i need to change any setting inside my web host? for the phpsendmail function? can teach me how to do so pls...here is my script[quote]global $main_url; //getting values $emails=form_get("emails"); $subject=form_get("subject"); $mes=form_get("mes"); $emails=ereg_replace("\r","",$emails); $emails=ereg_replace("\n","",$emails); $emails=ereg_replace(" ","",$emails); $emails=",".$emails; $email=split(",",$emails); $email=if_empty($email); $data[0]=$subject; $now=time(); if($email!=''){ show_header(); echo "<table width=100% class='body'> <tr><td class='lined title'>Invitation</td> <tr><td class='lined'>"; foreach($email as $addr){ //if user is site member - standart invitation $sql_query2="select mem_id from members where email='$addr'"; $num=sql_execute($sql_query2,'num'); if($num!=0){ $fr=sql_execute($sql_query2,'get'); $sql_query="select mem_id from network where mem_id='$m_id' and frd_id='$fr->mem_id'"; $num2=sql_execute($sql_query,'num'); $sql_query="select mes_id from messages_system where (mem_id='$m_id' and frm_id='$fr->mem_id' and type='friend') or (mem_id='$fr->mem_id' and frm_id='$m_id' and type='friend')"; $num=sql_execute($sql_query,'num');[/quote] Link to comment https://forums.phpfreaks.com/topic/30386-phpsendmail-problem/ Share on other sites More sharing options...
timmah1 Posted December 12, 2006 Share Posted December 12, 2006 Are you passing the email field to the script?[code]<input type="text" name="email" size="20">[/code][code]$to = "$email";$subject = "Hi!";$body = "Hi,\n\nHow are you?";if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }[/code] Link to comment https://forums.phpfreaks.com/topic/30386-phpsendmail-problem/#findComment-139839 Share on other sites More sharing options...
c4onastick Posted December 12, 2006 Share Posted December 12, 2006 I assume that by:[quote]phpsendmail[/quote]You really mean: [code]mail();[/code]Its really easy actually, mail() accepts four arguments, a 'to' string, a 'subject' string, a 'message' string, and optional additional headers, here's an example:[code]$to = "[email protected]";$subject = "My First PHP-Sent EMAIL!";$message = "I am invincible!";mail( $to, $subject, $message );[/code]That's it! There are a few caveats though. The 'subject' string cannot contain any newline (\n) characters. The 'message' string's lines need to be less than 70 characters. And obviously, the 'to' string needs to be a valid email address. mail() doesn't return many (any that I've seen) error messages, so that can make troubleshooting a pain. The server on which you are running the script needs to have the sendmail daemon running, or else the mail wont get through (Assuming you're running it on a *nix box, no idea what needs to be there for Windows). Start small, make a little test script to email yourself, make sure it works, then expand it to "invite your friends".http://us2.php.net/manual/en/function.mail.php Link to comment https://forums.phpfreaks.com/topic/30386-phpsendmail-problem/#findComment-139840 Share on other sites More sharing options...
jackson5759 Posted December 12, 2006 Author Share Posted December 12, 2006 i wanted to know..i need to set anything on my web host for the phpsendmail? Link to comment https://forums.phpfreaks.com/topic/30386-phpsendmail-problem/#findComment-139850 Share on other sites More sharing options...
timmah1 Posted December 12, 2006 Share Posted December 12, 2006 You run either one of these scripts, no, you shouldn't Link to comment https://forums.phpfreaks.com/topic/30386-phpsendmail-problem/#findComment-139861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.