Formsend Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tim1681
Forum Newbie
Posts: 5
Joined: Sun Mar 27, 2005 1:54 pm

Formsend Function

Post by Tim1681 »

Hey guys, got a question. On my site i want to put some Forms. I have the code installed and when I test it out, everything works dandy on the client side. But on the server side it does not send the form as an email. I've opened port 25 for the server but still nada :( . Is there a certain Module i need to install or something i need to change in my php.INI?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

If this is your own server, that is, you've installed PHP on your own computer, you may have fallen victim to a blocked SMTP port by your ISP. I know optonline does that, so you have to configure PHP to use their SMTP server to send outbound emails. What's your ISP?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

post. your. code.
Tim1681
Forum Newbie
Posts: 5
Joined: Sun Mar 27, 2005 1:54 pm

Post by Tim1681 »

My ISP Is comcast, so it wouldnt surprise me if they did block the SMTP Port.

Code: Select all

<?

$name = $_POST["name"];
$address = $_POST["address"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$comments = $_POST["comments"];


$today = date("M d, Y");
$recipient = "zerogroundz@gmail.com";
$subject = "Web Form Results";
$forminfo =
"Name: $name\n
Address: $address\n
City: $city\n
State: $state\n
Zip: $zip\n
Phone: $phone\n
Email: $email\n
Comments: $comments\n
Form Submitted: $today\n\n";

$formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email");
?>
There's an HTML page that sends the Info to this page. If you want me to post that code, I will.


feyd | Please review how to post code using

Code: Select all

and

Code: Select all

tags. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

..and your server is your local machine? If so, Comcast is blocking most users access to SMTP relay. In this case, you need to use an SMTP mailer script, like phpmailer. If I recall correctly, it allows you to log into your real smtp server, and thus email like "normal."
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Hmm... it doesn't look like anything is wrong. Comcast's blocking is pretty spotty: http://www.unspam.com/fight_spam/articles/1394.html

Try rerouting your smtp connection via these INI changes:

Code: Select all

&#1111;mail function]
; For Win32 only.
SMTP = smtp.comcast.net ; for Win32 only
smtp_port = 25
sendmail_from=  someemailaddress@exampledomain.com; for Win32 only
Tim1681
Forum Newbie
Posts: 5
Joined: Sun Mar 27, 2005 1:54 pm

Post by Tim1681 »

TY Very Much Ambush! :D Works like a charm 8) You should get a raise
Tim1681
Forum Newbie
Posts: 5
Joined: Sun Mar 27, 2005 1:54 pm

Post by Tim1681 »

In my code i have the line:

Code: Select all

$recipient = "zerogroundz@gmail.com";
Is there anyway to have a CC made and sent to another Email Address?

Thnx in advance! :)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Check out the PHP documentation for mail() : http://us4.php.net/manual/en/function.mail.php and also do some research on email headers.
Tim1681
Forum Newbie
Posts: 5
Joined: Sun Mar 27, 2005 1:54 pm

Post by Tim1681 »

Thnx Again. lol :lol:
Post Reply