PHP Coding for Sending Mail( ) Page Info

Discussion in 'Email' started by mreade, Jan 31, 2011.

  1. I have a PHP web page where users can fill in information, insert their email address then select "Submit" to email me the form information.

    This worked with my previous web hosting service. However, when using this same page, when I select the "Submit" I get the following error message:

    "Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\web\[mydomainname]\testdata\testdatathankyou.php on line 454"

    Do you have any suggestions how I can get this working on your Winhost Servers?

    Thanks,
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  3. Ray,

    Thanks for your reply. While waiting for same, I kept digging a little and found the following which does seem to work for sending form data via PHP coding.

    I added the following two lines of code to what I already had at the top of my php coding:


    ini_set(“SMTP” , “mail.yourdomainname.com”);
    ini_set(‘sendmail_from’ , ‘[email protected]’);



    After I added this and uploaded the new page, i was able to successfully send/receive the form data from IE, Safari, and Chrome to my Outlook inbox.

    I have printed off your reply and will keep same in case my workaround goes sour.

    Thanks!
     

Share This Page