Jump to content

configuring to send email


dumdumsareyum

Recommended Posts

Ok, I'm trying to figure out how to get php to send an email for the first time  :o.

I followed the instructions listed here:

http://deepakssn.blogspot.com/2006/06/gmail-php-send-email-using-php-with.html

 

Now when i get run the program i get this:

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\wamp\www\class.smtp.php on line 106

Mailer Error: Language string failed to load: connect_host

 

i went into the php.ini file and uncommented the line

extension=php_openssl.dll

 

but that didn't work

I looked in the php documentation and it said I needed to download openssl so I downloaded an executible version and now it's on my pc but I don't think it's really doing much to improve my situation....

I also added the path to my php in the control panel--system variables--path area  and I get the same warning as before.

 

What should I do? Thanks

Link to comment
https://forums.phpfreaks.com/topic/58471-configuring-to-send-email/
Share on other sites

OK here is something that send mail rather nicley. If you need checks and ballances you can find some additional code in the php tutorials here on phpfreaks.

 

 

<?php 

// send an e-mail
$msg = "A User Has dome something.\nThe information is:\n\n";
$msg .= "First name: " . $_POST[FName] . "\n"; //these are some sample variables             \\for amusment purposes. this is data input froma form and sent in mail.
$msg .= "Lastname: " . $_POST[LName] . "\n";
$msg .= "Email: " . $_POST[Email] . "\n";
$msg .= "Organization: " . $_POST[Org] . "\n";
$msg .= "Address: " . $_POST[Addy] . "\n";
$msg .= "City: " . $_POST[City] . "\n";
$msg .= "State: " . $_POST[state] . "\n";
$msg .= "Zip: " . $_POST[Zip] . "\n";
$msg .= "Phone: " . $_POST[Phone] . "\n\n";

$to = "some_name@some_domain.com";
$subject = "Some_Subject";
$headers = "From: [email protected]\n";
$headers .= "Reply-To: [email protected]\n\n";

mail($to, $subject, $msg, $headers);
\// this sends the user to whatever url you want them to go to after thay have made their post or provided input.
header( "Location: http://www.somedomain.com");
exit;

}



// CLose the php block.
?>

Hope it helps

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.