Webmaster Malaysia Forum  


Go Back   Webmaster Malaysia Forum > Website Design & Development > Website Programming

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Code or mail function problem?
Old
  (#1 (permalink))
Blogging Moderator
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
 
calvynlee's Avatar
 
Status: Offline
Posts: 1,523
Join Date: Jul 2006
Location: LittlePenang.com
Rep Power: 55
Code or mail function problem? - 10-05-2008, 10:42 AM

hi all coder here,

I do a simple form for inquiry purpose, inquiry.htm and here is the code


Code:
<form method="post" action="inquiry.php">

<?php
$ip = getenv("REMOTE_ADDR");
$httpref = getenv ("HTTP_REFERER");
$httpagent = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ip ?>" />
<input type="hidden" name="httpref" value="<?php echo $httpref ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagent ?>" />

    
    <p>Your Name: <br>
    <input type="text" name="visitor" size="35"> (Require)<br>
    Your Email:<br>
    <input type="text" name="visitormail" size="35"> (Require)<br>
    Subject <br>
    <input type="text" name="visitorsubject" size="35"> (Require)<br>

    
    <p>
    
    Attention:<br>
    <select name="attn" size="1">
    <option value=" General Support ">General Inquiry</option>
    <option value=" Sales & Presales ">Sales n Pre-Sales</option>    
    <option value=" Technical Support ">Technical Support</option>
    <option value=" Payment & Billing ">Payment & Billing</option>
    </select> <br>

    Mail Message: <br>
    <textarea name="notes" rows="4" cols="40"></textarea> 

    <input type="submit" value="Send">
and after my visitor fill up the form, it will link to inquiry.php

PHP Code:
<html>
<head> 
<title>Sendemail Script</title>
</head>
<body>


<?php

$ip 
$_POST['ip']; 
$httpref $_POST['httpref']; 
$httpagent $_POST['httpagent']; 
$visitor $_POST['visitor']; 
$visitormail $_POST['visitormail'];
$visitorsubject $_POST['visitorsubject'] ;
$notes $_POST['notes'];
$attn $_POST['attn'];


if (
eregi('http:'$notes)) {
die (
"Do NOT try that! ! ");
}
if(!
$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo 
"<h2>Use Back - Enter valid e-mail</h2>\n"
$badinput "<h2>Feedback was NOT submitted</h2>\n";
echo 
$badinput;
die (
"Go back! ! ");
}

if(empty(
$visitor) || empty($visitormail) || empty($notes )) {
echo 
"<h2>Use Back - fill in all fields</h2>\n";
die (
"Use back! ! "); 
}

$todayis date("l, F j, Y, g:i a") ;

$attn $attn 
$subject $attn

$notes stripcslashes($notes); 

$message " $todayis [EST] \n
Attention: $attn \n
Subject : $visitorsubject \n
Message: $notes \n 
From: $visitor ($visitormail)\n


Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
"
;

$from "From: $visitormail\r\n";


mail("me@myemail.com"$subject$message$from);

?>

<p align="center">
Date: <?php echo $todayis ?> 
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) 
<br />

Attention: <?php echo $attn ?>
<br /> 
Message:<br /> 
<?php $notesout str_replace("\r""<br/>"$notes); 
echo 
$notesout?> 
<br />
<?php echo $ip ?> 


</body>
</html>
after settle, i do try it, but unable to receive my email, any one can help me point out where is my problem?


I Blog LIFE at iCalvyn.com
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#2 (permalink))
Senior Webmaster
mylinear is on a distinguished road
 
Status: Online
Posts: 220
Join Date: Jan 2007
Location: -
Rep Power: 23
10-05-2008, 12:37 PM

Quote:
Originally Posted by calvynlee View Post
and after my visitor fill up the form, it will link to inquiry.php

$from = "From: $visitormail\r\n";
Replace the above with:

Quote:
$from = "From: $visitormail\r\n\r\n";
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
It's not your code
Old
  (#3 (permalink))
Inspired Webmaster
Seanie will become famous soon enough
 
Seanie's Avatar
 
Status: Offline
Posts: 120
Join Date: Mar 2008
Location: pd
Rep Power: 6
It's not your code - 10-05-2008, 09:08 PM

That code should work just fine (I couldn't see the error, so I ran it here). The double line break should be added by the mail() function. Do you have access to your web and mail server logs? Maybe there's an error in there. That is a dummy email address you posted and not the actual one you used, is it? Just checking!
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#4 (permalink))
Senior Webmaster
mylinear is on a distinguished road
 
Status: Online
Posts: 220
Join Date: Jan 2007
Location: -
Rep Power: 23
11-05-2008, 03:01 AM

Seanie could be right that the problem could be with the email address. I guessed the dummy email address was used by calvynlee just to post here. Or perhaps the email address used during the form submisssion is being rejected by Hotmail or Yahoo or your own email domain due to it being a non-existing email or something and being caught by filters or sent to Junk / Bulk folder.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#5 (permalink))
Blogging Moderator
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
 
calvynlee's Avatar
 
Status: Offline
Posts: 1,523
Join Date: Jul 2006
Location: LittlePenang.com
Rep Power: 55
11-05-2008, 09:47 AM

i do upload the same code in different server, and another server(exabytes) work fine for me.

I do check with the server which unable to run, they reply me as below

Quote:
Dear Customer,

We have disabled sending any emails with the field 'FROM; containing email address on the domain that does not exist on the server.

We have taken these measures due to mass SPAM sending through forums, guestbooks, contact forms scripts on our servers. Mail relaying is also prohibited. You need to change your script's settings.

In order for your scripts to work as intended, you need to set the 'FROM' field to an email address that you have created under your account.
does this server giving a normal service?


I Blog LIFE at iCalvyn.com
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#6 (permalink))
Senior Webmaster
mylinear is on a distinguished road
 
Status: Online
Posts: 220
Join Date: Jan 2007
Location: -
Rep Power: 23
11-05-2008, 11:31 AM

Ask them how you are supposed to get a visitor's enquiry via a form and reply back to the visitor if the visitor cannot put their own email address in the form. The visitor will have an email address not on your server or a Hotmail or Yahoo etc adress which will be blocked.

Your workaround could be to use an email address of your own domain as the From field and place the visitor's email address in the body of the message. This has to be done via the script after the form is submitted. Then you will have to manually use that address when replying to the visitor.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Maybe draconian,
Old
  (#7 (permalink))
Inspired Webmaster
Seanie will become famous soon enough
 
Seanie's Avatar
 
Status: Offline
Posts: 120
Join Date: Mar 2008
Location: pd
Rep Power: 6
Maybe draconian, - 11-05-2008, 11:39 AM

but not totally unreasonable. Maybe you need to be setting the 'Return-path' or something instead. I'm no mail guru, but it seems to me that another workaround would be to receive mail From enquiryform@yourdomain.com and cc to the sender, or to include the sender's address in the message only.

Good luck with that!
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
php ob_start function Redzuan9999 Website Programming 2 04-12-2007 10:38 AM
E-Mail Backup, Email Defense, E-Mail Marketing! Get one for your website! starsearcher Web Hosting Offers 0 16-01-2006 12:03 PM
Problem login to yahoo mail ac. sportstoto3368 Website Design 1 22-10-2004 06:24 AM
stripslashes() function for JSP? lcf Website Programming 3 21-04-2004 10:06 PM
problem in code(VB script babysakura Website Programming 0 30-12-2003 09:09 AM




Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
vBulletin Skin developed by: vBStyles.com

WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57