Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: is it possible to send e-mail w/ php in it?

  1. #1
    Join Date
    Apr 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default is it possible to send e-mail w/ php in it?

    Hi, I'm kinda new at this, so forgive me if there is an easy way to do this. I have been searching the internet high and low for the past 3 days trying to find out how I might be able to do this, but I find no references about sending a PHP e-mail.

    I have the working script to generate a quote result. The php basically checks to see if there is a value and if not, it won't print that table, if yes, then it will print the table.

    I'm wanting to know if I can send php in a html e-mail from the form. I basically want the e-mail to look like the web-page generated.

    Here is the form:

    http://www.enwassociates.org/php/quote-form2.html

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No. However, you can send the HTML output of the PHP.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    PHP must be INTERPRETED server side. You can't have that happen in an email.

    Send a link, or, as Twey says, outputted html from php.


    Arguably, you could use an iframe or something, but I doubt that would be compatible with many or any email viewers.

  4. #4
    Join Date
    Apr 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    No. However, you can send the HTML output of the PHP.

    Twey is this a simple procedure? like a one line code thing? Can you point me in the right direction please? I'm not lazy, I just need the right info, I don't know what to search for on that... but i'll try looking, I wasn't sure before, but now that I know, maybe I can find something...

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not unless you post the PHP you would try to send, no.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    PHP outputs html. That's WHAT it does... nothing more, nothing less. (Plus, I guess, cookies and serverside stuff.)


    What you do is store *whatever you want* into a variable.

    Then use the mail() command.

    Then as the body of the message, include that variable.

    You're done.

    php.net > search for "mail".

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    PHP outputs html. That's WHAT it does... nothing more, nothing less. (Plus, I guess, cookies and serverside stuff.)
    PHP is a highly versatile language; whole programs can be written in it, it's not only for web backends.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Well.. ok. I just meant that it's a method to output html. It can do other stuff, but all it usually does it output html, and that's the only thing that can be sent within an email from it.
    You're right, on the bigger scale, though.

  9. #9
    Join Date
    Apr 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33
    PHP outputs html. That's WHAT it does... nothing more, nothing less. (Plus, I guess, cookies and serverside stuff.)


    What you do is store *whatever you want* into a variable.

    Then use the mail() command.

    Then as the body of the message, include that variable.

    You're done.

    php.net > search for "mail".
    I understand all this plain and clear. I have successfully sent an html email. But the problem is, I have a form that the user inputs the amount they have, and I want the email to display ONLY the items that the customer has, and discard the rest, instead of displaying a table that has a ****load of cells that say QTY: 0.

    my output is a .PHP file even though it is generating the html.

    So I guess at this point my questions is, what command (if there is one) am I looking for that will convert the generated html into an actual .html file? I was looking this up earlier and haven't found anything yet that shows me how to do this. I was seeing something that suggested creating a site cache... but I don't think all that will be necessary if there is a simple way to create a .html file out of each generated page.

  10. #10
    Join Date
    Jul 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You could try writing to a php file and sending that file as an attachment.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •