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
PHP e-mail scripts not working
Old 07-10-2006, 05:00 PM PHP e-mail scripts not working
Skilled Talker

Posts: 90
Trades: 0
Hi,

My mail function of PHP does not work. I've tried several scripts, most very basic just to test the mail feature.. none of which work. The server is Windows and i plugged in the separate SMTP server into the php.ini as follows:

Code:
[mail function]
; For Win32 only.
SMTP = 147.***.233.10
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
I restarted the server after making the changes.. but the e-mails still don't go.

Here's an example of the test scripts i'm running:

PHP Code:
<?php

if (isset($_POST['sendit'])) {

    
$to "msaz87@yahoo.com"//Change to your email
    
$subject "Test Email";
    
$message "Hello, this is a test email.";
    
$headers "From: someone@somewhere.com";

    echo 
"Mail sent, check your inbox";
    exit;

} else {

?>

<form  method="post" action="<?php $_SERVER['PHP_SELF']; ?>">

<input type="submit" name="sendit" value="Send It" />

</form>

<?php

}

?>
Any ideas?
msaz87 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-10-2006, 10:34 PM Re: PHP e-mail scripts not working
Webmaster Talker

Posts: 626
Trades: 0
You are missing the mail function:

Code:
<?php

if (isset($_POST['sendit'])) {
    $to = "msaz87@yahoo.com"; //Change to your email
    $subject = "Test Email";
    $message = "Hello, this is a test email.";
    $headers = "From: someone@somewhere.com";

    mail($to, $subject, $message, $headers);  //  <--- This line was missing!
    echo "Mail sent, check your inbox";
} else {
   $frm =<<<FRMTXT
      <form  method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
      <input type="submit" name="sendit" value="Send It" />
      </form>
FRMTXT;

   echo $frm;
}

?>
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 07-11-2006, 01:22 AM Re: PHP e-mail scripts not working
Skilled Talker

Posts: 90
Trades: 0
Well, i tried adding that line in:

PHP Code:
<?php

if (isset($_POST['sendit'])) {

    
$to "msaz87@yahoo.com"//Change to your email
    
$subject "Test Email";
    
$message "Hello, this is a test email.";
    
$headers "From: someone@somewhere.com";

    
mail($to$subject$message$headers);
    echo 
"Mail sent, check your inbox";
    exit;

} else {

?>

<form  method="post" action="<?php $_SERVER['PHP_SELF']; ?>">

<input type="submit" name="sendit" value="Send It" />

</form>

<?php

}

?>
But it still did not send.

Any ideas? Thanks.
msaz87 is offline
Reply With Quote
View Public Profile
 
Old 07-11-2006, 01:46 AM Re: PHP e-mail scripts not working
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
have you checked your junk folder? Most mail providers junk mail sent with php unless eveything is perfect, Like headers senders address.
__________________

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
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 07-11-2006, 01:56 AM Re: PHP e-mail scripts not working
Skilled Talker

Posts: 90
Trades: 0
Yea, i'm not getting any messages.

It worked before on the other server, but not this one.
msaz87 is offline
Reply With Quote
View Public Profile
 
Old 07-11-2006, 06:43 AM Re: PHP e-mail scripts not working
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
It is very probable that this server won't let your message pass through it because it does not serve the specified mailbox, prohibits relaying and requires athentification. Try another one or change the concept.
__________________

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

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-11-2006, 10:16 AM Re: PHP e-mail scripts not working
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
Are you sure your host has mail() enabled? Are you running it on free hosting?
__________________

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
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 07-12-2006, 01:49 AM Re: PHP e-mail scripts not working
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Yes, stOx's question sounds reasonable. Look what does mail() return. If it returns false then mail() is disabled or badly configured.
__________________

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

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-12-2006, 11:01 AM Re: PHP e-mail scripts not working
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
If you are running off your own local server, and you don't have a mail server running, you can try plugging in your ISP SMTP or any other SMTP you have access to. Not sure about those that require authintication though.

Example:
Code:
[mail function]
; For Win32 only.
SMTP = smtp.sbcglobal.net
smtp_port = 25
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP e-mail scripts not working
 

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