Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

TracyJ
Joined: Eons Ago
# Posts: 592

View the profile for TracyJ Send TracyJ a private message

Posted: 2004-Apr-20 22:16
Edit Message Delete Message Reply to this message

As I continue to fumble my way through my first real site using PHP, I have yet another question...

I have many instances on our old site of CGI form processing where the script has to send two different emails out, one to our company and one to the customer. How do I do this in PHP? If I just call the mail() function twice for the two different emails, the second one doesn't get sent.

Thanks again in advance,

Tracy



NEntropy
Joined: Dec 08, 1999
# Posts: 1117

View the profile for NEntropy Send NEntropy a private message

Posted: 2004-Apr-23 19:50
Edit Message Delete Message Reply to this message

Hmm, you should be able to call mail twice to send two messages. Another possibility is setting 2 email addresses in the 'to' field, separated by comma. I seem to recall it working in PHP's mail function...



TracyJ
Joined: Eons Ago
# Posts: 592

View the profile for TracyJ Send TracyJ a private message

Posted: 2004-Apr-23 19:55
Edit Message Delete Message Reply to this message

Problem is, it's two different messages, so I can't just do two email addresses in the 'to' field.

It's not working at all, and when I posted on another forum, someone else said there shouldn't be any problem... and yet... there is! Argh.



TracyJ
Joined: Eons Ago
# Posts: 592

View the profile for TracyJ Send TracyJ a private message

Posted: 2004-Apr-23 23:50
Edit Message Delete Message Reply to this message

Finally figured it out. I don't know why it makes a difference, but if I use "return mail()" it doesn't work. If I just call "mail()" it works.



NEntropy
Joined: Dec 08, 1999
# Posts: 1117

View the profile for NEntropy Send NEntropy a private message

Posted: 2004-Apr-25 00:34
Edit Message Delete Message Reply to this message

Ah, that's because if you do return mail(); then after that command is run, the control of the software goes to the original calling function... Say you have the following code:

1 - function test(){
2 - command
3 - command
4 - return command
5 - command
6 - }

The commands in lines 2, 3, 4 are run, but it never gets to line 5, because the "return" keyword in line 4 will make the script jump over the line 5 and go directly to the original calling command.



TracyJ
Joined: Eons Ago
# Posts: 592

View the profile for TracyJ Send TracyJ a private message

Posted: 2004-Apr-26 19:29
Edit Message Delete Message Reply to this message

Gotcha. That makes a lot of sense. Gee, I'm such a newbie! Thanks for helping me figure it out. smile


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions