Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Simple way to send email from form with PHP?

Options
  • 29-07-2010 4:10pm
    #1
    Registered Users Posts: 19,025 ✭✭✭✭


    Hi All,
    I am trying my best (in vain so far) to get PHP to send e mail (from googlemail, I have no email server) when a visitor leaves a message in a html form (using method get etc.). The site is on my windows laptop at the moment (no email server, just apache and PHP installed)

    I started down the path of trying the built in mail() function but is seems it doesn't support smtp authentication whatsoever (so I can't pass it my username/password to let it authenticate itself with the eg googlemail server) so I see that the pear email package does apparantly support smtp authentication, so I try that (pita getting pear to work!) then I see that googlemail requires SSL, so here I am trying to get openSSL to work, which I can't seem to!

    Current error in browser:
    Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )]
    

    I am not even sure what the phpinfo screen should look like if ssl is enabled, anybody got a screenshot of that?

    If someone canm help me with getting openSSL to enable under PHP that would be fantastic, but I'm open to suggestions to simplify this...

    Remember: I have no email server and wish to send mail via googlemail (or similar if I have to open a new account, no problem). Thanks for any and all help with this, doing my head in...


Comments

  • Registered Users Posts: 6,509 ✭✭✭daymobrew


    As the site is on your Windows machine you could install a SMTP server.

    Or look at PHPMailer. It seems to work with Gmail.

    Or other options.


  • Registered Users Posts: 19,025 ✭✭✭✭murphaph


    Thanks very much for taking the time to help daymo, but I just this minute realised my (incredibly stupid) mistake! (I was editing a "fake" php.ini file, don't know where it came from but I realised something was amiss when I tried to change the timezone setting to berlin in it and it didn't change).

    I now have openSLL running (took 60 seconds once I'd realised my mistake!) and have successfully sent messages using gmail's server directly from the PHP script (I guess PHPmailer would be quite similar to the package I am using, but with built in SSL it would seem).

    Thanks again, appreciate it!


Advertisement