ploppy Posted August 6, 2007 Share Posted August 6, 2007 hello. i am trying to understand why this script is not sending mail. here is then php: <?php / /*=================================================== ShowFormSendMail() ===================================================*/ function ShowFormSendMail() { // vars global configuration global $dbConn, $theme_path; // vars url & form global $u, $lid, $revid, $to; // vars messages global $msg; // vars template global $error_msg, $email, $name, $body, $subject; if ($u) { $to = $u; } elseif ($lid) { $to = $dbConn->Lookup('contact_name', 'idx_link', "link_id = '$lid'"); } elseif ($revid) { $to = $dbConn->Lookup('username', 'idx_review', "review_id = '$revid'"); if (!$to) { $to = $dbConn->Lookup('name', 'idx_review', "review_id = '$revid'"); } } $name = stripslashes($name); $subject = stripslashes($subject); $body = stripslashes($body); DisplayTemplate($theme_path . "sendmail_form.html", "\$error_msg,\$email,\$name,\$to,\$u,\$lid,\$revid,\$body,\$subject"); } /*=================================================== ProcessFormSendMail() ===================================================*/ function ProcessFormSendMail() { // vars global configuration global $dbConn, $theme_path; // vars url & form global $error_msg, $email, $name, $u, $lid, $revid, $to, $body, $subject; // vars messages global $msg; // vars template global $error_msg; // verify input $name = stripslashes($name); $subject = stripslashes($subject); $body = stripslashes($body); if (empty($email)) $error_msg = $msg["10282"]; elseif (!IsEmailAddress($email)) $error_msg = $msg["10283"]; if (empty($error_msg)) { if ($u) { $users_obj = new clsUsers; $users_obj->table_name = "idx_users"; $email_to = $users_obj->GetEmailAddress($u); } elseif ($lid) { $email_to = $dbConn->Lookup('email', 'idx_link', "link_id = '$lid'"); } elseif ($revid) { $email_to = $dbConn->Lookup('email', 'idx_review', "review_id = '$revid'"); if (!$email_to) { $to = $dbConn->Lookup('username', 'idx_review', "review_id = '$revid'"); $users_obj = new clsUsers; $users_obj->table_name = "idx_users"; $email_to = $users_obj->GetEmailAddress($to); } } $email_from = $email; $from = $name . "<$email_from>"; @mail($email_to, $subject, $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); DisplayTemplate($theme_path . "sendmail_ok.html", "\$to,\$u"); } else { ShowFormSendMail(); } } /*=================================================== main ===================================================*/ include "application.php"; RunPreFilter(__FILE__); if (empty($pflag)) { ShowFormSendMail(); } elseif ($pflag == 'send') { ProcessFormSendMail(); } RunPostFilter(__FILE__); ?> here is the sendmail_form.html: <%include file="header.html" title="Send Email" meta_keywords="" meta_description="" %> </td> </tr> <tr> <td> <!-- main content here --> <br /> <form action="sendmail.php" method="post"> <input type="hidden" name="pflag" value="send" /> <input type="hidden" name="u" value="<%$u%>" /> <input type="hidden" name="lid" value="<%$lid%>" /> <input type="hidden" name="revid" value="<%$revid%>" /> <input type="hidden" name="to" value="<%$to%>" /> <%if $error_msg%> <center><p><font color="Red"><b><%$error_msg%></b></font></p></center> <%/if%> <table cellpadding="4" cellspacing="1" border="0" align="center" width="100%" class="tbl_border"> <tr> <td class="tbl_caption" colspan="2"> Contact Us </td> </tr> <tr class="tbl_normal"> <td>Your Name</td> <td><input class="text3" type="text" name="name" size="40" value="<%$name%>" /></td> </tr> <tr class="tbl_normal"> <td>Your Email Address</td> <td><input class="text3" type="text" name="email" size="40" value="<%$email%>" /></td> </tr> <tr class="tbl_normal"> <td>To</td> <td><b><%$to%></b></td> </tr> <tr class="tbl_normal"> <td>Subject</td> <td><input class="text3" type="text" name="subject" size="40" value="<%$subject%>" /></td> </tr> <tr class="tbl_normal"> <td valign="top">Message</td> <td><textarea cols="40" rows="10" name="body" style="overflow: auto;"><%$body%></textarea></td> </tr> <tr class="tbl_normal"> <td><img src="captcha.php" alt="" /></td> <td><input class="text3" type="text" name="captcha_key" size="40" value="" /></td> </tr> <tr class="tbl_normal"> <td> <center> </center> </td> <td><input type="submit" name="submit" value="Send Email" /></td> </tr> </table> </form> <br /> <br /> <!-- end of main content --> </td> </tr> <tr> <td> <%include file="footer.html"%> and the sendmail_ok.html <%include file="header.html" title="Send Email" meta_keywords="" meta_description="" %> </td> </tr> <tr> <td> <!-- main content here --> <br /> <b>Send Email</b> <p>Your email has been sent to <%if $u%> <a href="<%$site_url%>/user_detail.php?u=<%$to%>"><%$to%></a>. <%else%> <%$to%>. <%/if%></p> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <!-- end of main content --> </td> </tr> <tr> <td> <%include file="footer.html"%> what i am having trouble understanding is that script seems to send the form, but nothing arrives. also the response form to client only states: Send Email Your email has been sent to . and no name there. as i am brand new to php any help would be grately appreciated. many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/63569-newbie-needs-assistance/ Share on other sites More sharing options...
samoht Posted August 6, 2007 Share Posted August 6, 2007 Why do you have <% %> tags if you're using php? are you trying to mix .asp with php? I think you should have php files e.g. sendmail_form.php etc Quote Link to comment https://forums.phpfreaks.com/topic/63569-newbie-needs-assistance/#findComment-316797 Share on other sites More sharing options...
ploppy Posted August 6, 2007 Author Share Posted August 6, 2007 the whole script uses these tags with smarty. all the other php works fine except this script. Quote Link to comment https://forums.phpfreaks.com/topic/63569-newbie-needs-assistance/#findComment-316800 Share on other sites More sharing options...
ploppy Posted August 6, 2007 Author Share Posted August 6, 2007 {BUMP}Anybody? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/63569-newbie-needs-assistance/#findComment-316920 Share on other sites More sharing options...
mohaakilla51 Posted August 6, 2007 Share Posted August 6, 2007 Unless you are doing this on your own server, then your server might not support the php mail functions. Especially if you are using a free host, the chances of it supporting the mail functions is quite low because of spam mailers/ Quote Link to comment https://forums.phpfreaks.com/topic/63569-newbie-needs-assistance/#findComment-316926 Share on other sites More sharing options...
ploppy Posted August 6, 2007 Author Share Posted August 6, 2007 i have own dedicated server running php 4.4.7. all i am trying to find out, is why it is not sending to address? so i can understand the script. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/63569-newbie-needs-assistance/#findComment-316981 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.