Jump to content

Archived

This topic is now archived and is closed to further replies.

jcombs_31

mail problem

Recommended Posts

I don't really have a problem sending a simple text email, the problem is that I'm trying to redirect after the mail is sent to a notification page.  It seems that when I redirect, the mail doesn't get sent.  I tried setting a variable to the mail function, and then check for the variable to redirect, like this

[code]
$sent = mail($to, $subject, $message, $headers);

if($sent)
header("Location: somepage.php");
[/code]

If I don't send the redirect header, the mail goes fine.

Share this post


Link to post
Share on other sites
Try:
[code]
if (mail($to, $subject, $message, $headers))
   header("Location: somepage.php");
else {
  // whatever code you want to execute
}
[/code]

Ronald   8)

Share this post


Link to post
Share on other sites
I tried it that way as well, which is why I tried checking for the variable.  It's like the page redirects before the mail function gets a chance to work.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.