Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  • Thread Tools
  • Rate This Thread
  1. #1
    New to the CF scene
    Join Date
    Apr 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems creating a form with php script

    Hi,
    I tried to create a form and send it with php mailer using smtp. I researched the net, worked long hours but in the end I couldn't send an email.
    Can anyone give me a simple example of a form and php script to test on my website with php mailer or other service?
    Thanks

  2. #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    4,556
    Thanks
    14
    Thanked 476 Times in 471 Posts
    there’s a whole bunch of examples in PHPMailer’s repository: https://github.com/PHPMailer/PHPMail...aster/examples
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  3. #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,550
    Thanks
    3
    Thanked 402 Times in 393 Posts
    When code doesn't work, you need to determine why, so that you can actually fix what's causing the problem. Some things you need to do or supply to us to help you determine what the problem is -

    1) What code did you try (xxxxxx out your actual smtp username/email address and password, but don't change any of the syntax being used) and what symptoms or errors did you get?

    2) Do you have php's error_reporting set to E_ALL and display_errors set to ON so that php will help you by reporting and displaying all the errors it detects?

    3) Do you have phpmailer's ->SMTPDebug property set to at least the value 2 (there are apparently higher levels, though none are well documented unless you read the actual php code) and does your code test the result of the ->send() method and display/log the ->ErrorInfo property when the ->send() method fails?

    4) Does the server where you are running your php script at allow a connection to the mail server you are trying to connect to, i.e. is the necessary port (varies depending on using tls/ssl or not) blocked or allowed?
    Last edited by CFMaBiSmAd; 04-08-2016 at 02:47 PM.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  4. #4
    New to the CF scene
    Join Date
    Apr 2016
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Although making it functional will require a little bit of server side programming, I’ll be glad to point you to the right direction!

    In order to make this form function for your website, you’ll need to code it with PHP.

    Note: the PHP contact form tutorial focuses on just making it work functionally, but you will just need to add security features to it yourself

  5. #5
    New to the CF scene
    Join Date
    Apr 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am still waiting for a reply that could be useful....

  6. #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,550
    Thanks
    3
    Thanked 402 Times in 393 Posts
    The amount of help you can get for any programming problem is directly proportional to the amount of useful information you supply about the problem.

    There are at least a dozen different things that could cause the phpmailer script to not 'work' on any particular system. Without feedback from you as to what your code is, what if any php or phpmailer errors you are getting, or even if your hosting allows a connection to the mail server you are trying to use, we cannot help you.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


 

Tags for this Thread

Posting Permissions

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