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
Old 05-31-2009, 02:52 AM Email sender
youngbobby's Avatar
Novice Talker

Posts: 5
Name: Young Bobby
Trades: 0
Hi,

I'm a complete newbie in php and i'm new here too.
I was trying to code a simple email sender with return path email address and it generated some errors.
I'll love someone to check this:
Code:
<?php
$to=$_REQUEST["to"];
$subject=$_REQUEST["subject"];
$from=$_REQUEST["from"];
$reply_to=$_REQUEST["reply_to"];
$message=$_REQUEST["message"];
$headers="From=$from\r\n Reply To:$reply";
$sent=mail($to, $subject, $message, $headers);
if ($sent)
{
echo "<p>Congratulations, Your mail has been sent</p>"
};
else
{
echo "<p>Please check, something is not right!</p>"
}
?>
Thanks.
youngbobby is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-31-2009, 03:31 AM Re: Email sender
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
do you get the email you send?
make sure you pass the correct value in
$to=$_REQUEST["to"];
__________________

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

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
Old 05-31-2009, 03:49 AM Re: Email sender
Super Talker

Posts: 134
Name: Larry
Trades: 0
What error did you get? Parse error? If so, I think there should not be a semicolon between the closing curly bracket "}" and the word "else" and there should be an semicolon at the end of each "echo" statement". Try this:

Code:
 
if ($sent)
{
echo "<p>Congratulations, Your mail has been sent</p>";
}
else
{
echo "<p>Please check, something is not right!</p>";
}
__________________

Please login or register to view this content. Registration is FREE
| Play
Please login or register to view this content. Registration is FREE
to kill time

Last edited by larryatwt; 05-31-2009 at 03:55 AM.. Reason: add "code" tags
larryatwt is offline
Reply With Quote
View Public Profile Visit larryatwt's homepage!
 
Old 05-31-2009, 06:19 AM Re: Email sender
Junior Talker

Posts: 4
Name: Alex
Trades: 0
Yeah, you need a semi-colon after your echos.
detroitredwings is offline
Reply With Quote
View Public Profile
 
Old 05-31-2009, 02:14 PM Re: Email sender
youngbobby's Avatar
Novice Talker

Posts: 5
Name: Young Bobby
Trades: 0
Ok, thank you guys. The parse problem has been fixed.

The problem is that i'm still not able to send mails with it because i was testing it.

Am I allowed to post links? I'd like to post a demo.

"Please check, something is not right!" is what i get yet all fields are valid.
Thanks
youngbobby is offline
Reply With Quote
View Public Profile
 
Old 05-31-2009, 03:44 PM Re: Email sender
Super Talker

Posts: 134
Name: Larry
Trades: 0
Just like nayes84 say, make sure you pass the correct value in
$to=$_REQUEST["to"];
You can echo this variable to see if it is correct. If you are sure all parameters in the mail function are correct, then you might have not set up your php email yet. I don't know how to set it up. Other WT fellows here might give you help. Good luck.
__________________

Please login or register to view this content. Registration is FREE
| Play
Please login or register to view this content. Registration is FREE
to kill time
larryatwt is offline
Reply With Quote
View Public Profile Visit larryatwt's homepage!
 
Old 05-31-2009, 06:40 PM Re: Email sender
youngbobby's Avatar
Novice Talker

Posts: 5
Name: Young Bobby
Trades: 0
Thank you Larry.
I think thats where my problem lies now. Setting up email.
I'll be glad if someone will help with that.
youngbobby is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Email sender
 

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.27571 seconds with 12 queries