+ Reply to Thread
Results 1 to 10 of 10

Thread: HTML Email not working

  1. #1
    Join Date
    Jul 2004
    Posts
    5

    Default HTML Email not working

    Formmail is awesome, and I had it working perfectly until I tried doing HTML emails.

    I followed your tutorial, but I think I am missing something minor thats messing it up.

    The error msg is as follows:
    The following error occurred in FormMail:
    Failed to open HTML template file 'private/sales/emailtemp.htm'

    I also receive a second email error msg:
    The following error occurred in FormMail:
    mail_failed
    **********
    Error=Failed to send email


    I have the formmail.php as follows:
    $TEMPLATEDIR = "private/sales";

    I put the page in the in the same directory only to troubleshoot (i will put it in its own directory again as you suggest once I get it working)

    any suggestions would be greatly appreciated

    the form is found at:
    http://www.memlane.com/sales/zatrcollege.htm

    Last edited by Rich; 21-Jul-2004 at 04:46 PM.

  2. #2
    Join Date
    Dec 2003
    Posts
    3,907

    Default Re: HTML Email not working

    Hi,

    The template files must be in a special directory for security reasons. This rule makes it impossible for an attacker to fool FormMail into accessing secret files on your web server.

    That's why we say "create a new directory to hold your templates".

    I think the only problem you're having is that you need to set $TEMPLATEDIR to the full path to that directory.

    Create a new directory on your server and set $TEMPLATEDIR to the full path from '/' to that directory. Put the template in there and it should work.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Jul 2004
    Posts
    5

    Talking Re: HTML Email not working

    thanks Russell. but its still not working, I am getting the same errors. I am going to try a few other options here, like different directories, folder attributes etc, but in the meantime, could you answer a quick question?

    Would it matter that I do not have every syntax set up? out of laziness, i only did the first couple, rather than all 30, just to see if I could get this working. Could it be that formail is looking for a place to put each field in the html template? does that makes any sense what I am trying to say?

    I will let you know if I get it working.
    Sincerely,
    Richard

    PS. maybe in your documentation, you should not have "We recommend you set aside a particular directory on your server for all your templates."

    but you "must set aside a particular directory..."

    not that i am being picky, you have an absolutely great program!

  4. #4
    Join Date
    Dec 2003
    Posts
    3,907

    Default Re: HTML Email not working

    Hi,

    I am going to try a few other options here, like different directories, folder attributes etc,
    I think you're having difficulty getting the full path of your directories.

    Can you write down the full path name to your home directory? Can you write down the full path name to your web server document root?

    The full path name is specific to your hosting company but always begins with '/' (on Linux/Unix systems).

    If not, that's the first step you need to overcome. This script can help:
    PHP Code:
    <? phpinfo(); ?>
    Open that with your browser. Then look down under the heading "Apache Environment" for the setting called "DOCUMENT_ROOT". That will almost certainly be the full path to your web server document root.

    Once you know the full path name, the rest is easy:
    1. create a directory in your document root called "fmtemplates".
    2. put the full path name to "fmtemplates" in $TEMPLATEDIR, for example: "/home/yourname/public_html/fmtemplates"
    3. Ensure that fmtemplates as the mode rwxr-xr-x
    4. Put your template file in that directory.
    If you're still stuck, I can help if you're happy to give me temporary access to your server.

    PS. maybe in your documentation, you should not have "We recommend you set aside a particular directory on your server for all your templates."

    but you "must set aside a particular directory..."
    Thanks for that - it's a good suggestion. We'll do it.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  5. #5
    Join Date
    Jul 2004
    Posts
    5

    Default Re: HTML Email not working

    got it!
    we use the super secure IIS <sarcassm/> I figured it was something to do with the pathing, and thats why i endend up trying it in the same dir as the formmail to troubleshoot.

    I put the template folder in the directory I am working in (and not the root as I think you suggested).

    so the following did not work...
    TEMPLATEDIR = "/private/sales/template";
    (sales is the dir were formmail is)
    (template, were the html form is)

    this is the only thing that would work

    TEMPLATEDIR = "temp";

    I had a forward slash, as soon as I took it out, bam, it works

    ... crazy? i think so

    thank you so much for your help, and keep up the awesome work!!
    Rich

    now I have a checkbox field, that i dont want to return an error if its not checked, and I know I seen the fix to that yesterday on here somewere, off to seach

  6. #6
    Join Date
    Dec 2003
    Posts
    3,907

    Default Re: HTML Email not working

    Great news. The solution you got is strange.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  7. #7
    Join Date
    Jul 2004
    Posts
    5

    Default Re: HTML Email not working

    actually, I made a mistake in the explanation, I meant that this is the only thing that would work

    TEMPLATEDIR = "template"; (not"temp")

    maybe for future reference

    Rich

  8. #8
    Join Date
    Dec 2003
    Posts
    3,907

    Default Re: HTML Email not working

    Hi,

    So you created a directory whose path is "/private/sales/template", and in FormMail you set

    PHP Code:
    $TEMPLATEDIR="template"
    Is that correct?

    That actually makes some sense...what appears to be happening is that formmail.php is installed in "/private/sales" and when your web server runs it, it sets the current directory for that script to "/private/sales".

    So, when FormMail tries to open "template/yourtemplate.htm", the relative path works.

    What doesn't make sense, and it's probably a Windows anomaly, is that the full path doesn't work.

    Anyway, it appears that relative paths will work OK.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  9. #9
    Join Date
    Jul 2004
    Posts
    5

    Default Re: HTML Email not working

    Quote Originally Posted by russellr
    Hi,

    So you created a directory whose path is "/private/sales/template", and in FormMail you set

    PHP Code:
      $TEMPLATEDIR="template"
    Is that correct?
    exactly
    damn windows, always messin things up.

    and thats why i was confused, I was trying every thing because I new it was a pathing issue, and it did suprise me also when this worked.

    What I found confusing, was not so much that the full path didnt work, but the forward slash didnt work.

    anyways, it works, Im happy, my boss is happy, (which helps when he is your father in law ) and your software and support rules!!

    Rich

  10. #10
    Join Date
    Dec 2003
    Posts
    3,907

    Smile Re: HTML Email not working

    Hi,

    Thanks for the details and the compliment.

    Please provide a link to our website to help us continue to provide free software and support.
    Last edited by russellr; 23-Jul-2004 at 10:18 PM.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Sending form results in an HTML email
    By russellr in forum HOWTO Guides and Tips
    Replies: 26
    Last Post: 12-Jan-2006, 09:31 PM
  2. HTML Email does not work if not all fields are filled.
    By onlmega in forum FormMail Subscription Support
    Replies: 7
    Last Post: 04-Aug-2004, 12:02 AM
  3. Can I Include an Image in an HTML Email??
    By minskin in forum FormMail Subscription Support
    Replies: 4
    Last Post: 19-Jun-2004, 03:43 PM
  4. HTML email reply
    By aussieincanada in forum FormMail Subscription Support
    Replies: 5
    Last Post: 04-Jun-2004, 07:07 AM
  5. send an email in HTML
    By michecosta in forum FormMail Subscription Support
    Replies: 3
    Last Post: 25-May-2004, 09:18 PM

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