PHP Mail With Values From 2 Sources

Posted on 2009-04-16
Last Modified: 2013-12-12
A form on my Web site sends its submitted values to a php page on my server (Apache), which then emails them to me.

The form values are also sent to a payment gateway, which creates some new values (Authorization Code, Transaction ID, etc.). I have the gateway configured to send its new values to another page on my server, which then sends them to me in a 2nd email.

I would like to send myself all values in a single email instead of 2 separate ones. But how would I go about doing this? I guess my question is: Can php code be written that would save values from 2 different sources, at 2 different times (a delay of probably 1 or 2 seconds), and then send a single email?
Question by:Jonathan Greenberg
    LVL 3

    Assisted Solution

    You could store the first email in a sessionand then connect it with the second email and send them together
    LVL 10

    Accepted Solution

    Yes, you can.

    You can use a session like QualitySoftware suggests, You can make a script wait for the response, you might store the data in some database until all data is collected and then send if to you. You could use the database to send the mail based on a stored procedure / database job. There are many approaches that might solve this for you.


    Author Comment

    by:Jonathan Greenberg
    Thank you both for your comments.

    Chris, one of your options was to "make a script wait for the response." I want to be clearer about what this means. Does this mean my script could receive the values from my Web form, wait until the response comes in from the payment gateway, and then send all values at once? If so, could it do this without using a session and/or a database?

    Author Comment

    by:Jonathan Greenberg
    I figured it out.  Thanks again.
    LVL 10

    Expert Comment

    Sorry i did not get back to you sooner. Im happy you figured it out :-)

    If we can be of more assistance just let us know :-)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now