fpdf - pdf sent as attachment using Pear Mail class - email with blank pdf being sent from server

Posted on 2009-02-23
Last Modified: 2012-05-06
Hi -

I'm using fpdf with Pear Mail class to send form results as a PDF email attachment.

When the form is submitted, the PDF is generated and all works well.

My issue is that the email with PDF attachment seems to be being sent from the server with blank results - in other words - the form is not being filled in (I know this because I inserted a hidden field in the form and the blank PDF did not print that value). So, this seems to be coming from the server somewhere - I'm getting 1 or 2 a week - just random.  Any ideas?
Question by:phillystyle123
    LVL 9

    Accepted Solution

    I would check the following:

    Can a form be submitted with no data? If so, you may want to add server-side validation so that the mail doesn't get set unless the required fields are filled out. JavaScript validation wouldn't be sufficient in your case (or anyone's really) as some users and virtually all spiders have JS 'disabled'.

    Record $_SERVER['REMOTE_ADDR'] somewhere in the PHP just before it sends out the email. I wouldn't be surprised if the culprit was a search engine spider accessing pages not excluded in your robots.txt. To remove the pages you don't want to be indexed (and executed) here is a robots.txt 'tutorial'.

    Good Luck

    Author Closing Comment

    I'm guessing this is the issue - thanks so much for the help!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    737 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

    15 Experts available now in Live!

    Get 1:1 Help Now