Sending Verification Email

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
akrohn
Forum Newbie
Posts: 1
Joined: Mon Mar 12, 2012 10:51 pm

Sending Verification Email

Post by akrohn »

I am trying to send an email to a person who registers on my site. I have two problems. First, here is the email script:

Code: Select all

        $message = "Thank you for registering.\n\n";
        mail($email, 'Registration Confirmation', $message, 'From: noreply@website.com');
Problem 1: I tried this on two identical pages, index.php and register.php. For some reason it only works on the index.php page.

Problem 2: When it does work on the index.php page, the From header does not show noreply@website.com, it shows that it is from my host. How can I fix that?

Thanks.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Sending Verification Email

Post by social_experiment »

http://php.net/manual/en/function.mail.php
Have a look at the mail() function. Regarding the second problem you could contact your hosting provider; please paste all the code for the two page; if the register page isn't working other code could be causing a problem stopping the execution of the script before reaching the part where the mail should be sent
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply