Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
form mailto script problem
Old 02-18-2010, 03:56 PM form mailto script problem
Junior Talker

Posts: 1
Name: Simon ROberts
Trades: 0
Hello Guys,

You have probably seen this a million tims butim new to anything php (or website for that matter really).

My wife has recently taken over a company from her parents and has been given the website, they have changed their name and hosting company, they have a website designed in frontpage thst i have swapped from one hosting company (linux)andchanged toanother (windowsbased).

Im having problems getting the online form to email "leads" to their sales email, heres the code which is being used (that works on their old server)

<SCRIPT LANGUAGE="php">
$email = $HTTP_POST_VARS[email];
$mailto = "sales@121-vans.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form by : ".$REMOTE_ADDR."\n\nVisiting Page : ".$HTTP_REFERER."\n\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$mailbody .= "$key : $val\n"; }
mail($mailto, $mailsubj, $mailbody, $mailhead);
</script>

Now all ive doen is change the email adddress -

<SCRIPT LANGUAGE="php">
$email = $HTTP_POST_VARS[email];
$mailto = "sales@vandiscount.co.uk";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form by : ".$REMOTE_ADDR."\n\nVisiting Page : ".$HTTP_REFERER."\n\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$mailbody .= "$key : $val\n"; }
mail($mailto, $mailsubj, $mailbody, $mailhead);
</script>

and this doesnt work on the new server (neither will the old email from the new server)

Has anyone any ideas? Ive asked for the hosting to change to linux from windows and also used -

<?php
$to = "sales@vandiscount.co.uk";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

to test that everything works how it should.

Thanks for any help

Simon
wynthorpe is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-19-2010, 09:42 AM Re: form mailto script problem
Experienced Talker

Posts: 31
Trades: 0
Hi wynthorpe,

All of your code looks fine.. I would try making a php file to check the settings that your web hoster has set up.

Try copying this code into a new php file
PHP Code:
<?php

phpinfo
();

?>
Check the SMTP Settings(just search for SMTP), and see if it gives a port number, and what it is configured to. It is possible that the web hoster dosent have it configured right... Hope this helps!

ASLO-- Try this code, and see what message that you get
PHP Code:
<?php
$to 
"sales@vandiscount.co.uk";
$subject "Test Email";
$body "The email worked!";
if (
mail($to$subject$body)) {
  echo(
"<p>Email Worked!</p>");
 } else {
  echo(
"<p>Email Failed</p>");
 }
?>
-Dillon

Last edited by Dillon; 02-19-2010 at 09:48 AM..
Dillon is offline
Reply With Quote
View Public Profile
 
Old 02-19-2010, 09:52 AM Re: form mailto script problem
Super Talker

Posts: 111
Trades: 0
Hi!

It is probably need to indicate path to sendmail.

My advise is contact your hosting company.

Alsom try simple mail function.



<?php
error_reporting(E_ALL);

mail($to,$subject,$message,$headers);
?>
__________________

Please login or register to view this content. Registration is FREE
- PHP/MySQL, XHTML/CSS, Ajax Development.


Please login or register to view this content. Registration is FREE
vasam is offline
Reply With Quote
View Public Profile
 
Old 02-19-2010, 01:40 PM Re: form mailto script problem
Defies a Status

Posts: 1,606
Trades: 0
Potentially silly question on my part but did you ask for frontpage extensions to be installed on those accounts?

FP does things in a perverted way.

BTW I have never seen code like what you posted.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 02-22-2010, 04:54 PM Re: form mailto script problem
Webalized's Avatar
Experienced Talker

Posts: 33
Trades: 0
I'm going to paste a script that i have tested hundreds of times on different projects
PHP Code:
<?php

// delivered via the nik.im url shortener. http://nik.im

/* Subject and Email Variables */

    
$emailSubject 'Contact Form Response';
    
$webMaster 'myEmail@gmail.com';
    
    
/* Gathering Data Variable */

    
$emailField $_POST ['email'];
    
$contactField $_POST ['#ofvids'];
    
$commentsField $_POST ['location'];
    
$camerasneededField $_POST ['camerasneeded'];
    
$sitepagesField $_POST ['sitepages'];
    
$sitetypeField $_POST ['sitetype'];
    
$otherField $_POST ['other'];


    
$body = <<<EOD

A Person Responded to the Video Sites Form on the Web Design Pages of the RDP Website
<hr>
Email: 
$emailField <br>
Number of Videos on Site: 
$contactField <br>
Filming Location: 
$commentsField <br>
Cameras Needed: 
$camerasneededField <br>
Number of Site Pages: 
$sitepagesField <br>
Type of Website: 
$sitetypeField <br>
If other they specified (optional): 
$otherField
EOD;

    
$headers "From: $email\r\n";
    
$headers .= "Content-type: text/html\r\n";
    
$success mail($webMaster$emailSubject$body$headers);


/* Results rendered as HTML */

    
$theResults = <<<EOD
<html>
<head>
<title>Rubber Ducky Producktions - Contact Verification</title>
<link rel= "shortcut icon" href= "rdpfavicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
    background-color: #f1f1f1;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #666666;
    text-decoration: none;
}
-->
</style>
</head>

<div>
<div align="center"></div>
</div>
</body>
</html>
EOD;
    
echo 
"$theResults";



?>
__________________

Please login or register to view this content. Registration is FREE

Webalized is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to form mailto script problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15579 seconds with 12 queries