Jump to content

Meriakh

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Meriakh

  1. So I turned on the error log for php. Managed to get some interesting output but haven't decided what to make of it yet. [23-Jun-2012 22:38:27] PHP Warning: include_once(Net/SMTP.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in C:\php\PEAR\Mail\smtp.php on line 348[23-Jun-2012 22:38:27] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.;C:\php\pear\') in C:\php\PEAR\Mail\smtp.php on line 348[23-Jun-2012 22:38:27] PHP Fatal error: Class 'Net_SMTP' not found in C:\php\PEAR\Mail\smtp.php on line 349[23-Jun-2012 22:38:28] PHP Warning: include_once(Net/SMTP.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in C:\php\PEAR\Mail\smtp.php on line 348[23-Jun-2012 22:38:28] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.;C:\php\pear\') in C:\php\PEAR\Mail\smtp.php on line 348[23-Jun-2012 22:38:28] PHP Fatal error: Class 'Net_SMTP' not found in C:\php\PEAR\Mail\smtp.php on line 349[23-Jun-2012 22:38:36] PHP Notice: Undefined variable: mail in C:\website\mailpractice.php on line 32
  2. Decided to try to use pear to send my emails and have come up with this code. Installed pear and pear mail. <?php include "C:/php/pear/Mail.php"; require_once "Mail.php"; $from = "user1@gmail.com>"; $to = "user2@yahoo.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://smtp.gmail.com"; $port = "465"; $username = "user1@gmail.com"; $password = "pass"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> and I am getting caught at this line in particular: $mail = $smtp->send($to, $headers, $body); Guess I'm wondering what could be causing this line not to run - I am at a bit of a loss here. Opened port 465 in my firewall/router, restarted apache. I've seen some very similar code online, so not sure what makes what I'm doing different. I am on a Windows XP box btw.
  3. So I've coded this short php snippet to test if I can send emails from my server. I set up the smtp server and opened ports on my firewall/router. I also set up my php.ini file with what I think are the correct inputs. I then restarted both the smtp and apache servers. When I run this code it outputs "Mail Sent!", but I am getting nothing sent to my email address. Is there something I am missing here? <?php$to = "user1@gmail.com";$subject = "HTML email";$message = "Hi";// Always set content-type when sending HTML email$headers = "MIME-Version: 1.0" . "\r\n";$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers$headers .= 'From: user2@gmail.com' . "\r\n";if(mail($to,$subject,$message ,$headers)){ echo "Mail Sent!";}else{ echo "Mail Failed to be sent";}?>
  4. So if I want to link the site in the email addressed to the admin for authentication I would want to link something like this? http://server/path?idVar=<ID of database_entry> Where the "ID of sql database entry" will be automatically input when the email is sent. And then of course the path would be the path to the authentication page, which would always be the same besides the ID input. Also, what kind of authentication would I need to use? Is there a good link to a place I could get information on site security in general, but also in regards to this?
  5. Simple and easy to do. Thanks for the idea, Ingolme. I actually have a followup question to your response. When the data is submitted to the database it should be straightforward to automatically notify me that something has been submitted. I haven't dealt with emails in php, but I just looked through it and it should be easy enough. When sending the email, I need to specify a link for me to go to, correct? And that link should pull the information that was submitted. I would think when sending the email I would need to specify the key associated with the database entry. Also, the link would somehow need to pass that key as a parameter so that I could pull all of the relevant information. From there, I would really like to be able to view the info in the way it will look when published on the site. So my question here: How would I be able to email myself a link which will allow me to view the submitted data? I guess I'm not real clear on how the site with the information displayed would be created.
  6. I was hoping to find out an answer to a relatively complex html/php/sql question. I have a form on my site that I want users to fill out. The user fills it out and then submits the form, sending it to a php file. That file is then supposed to add 1 entry to the sql database. What I want to do is put this data being sent to the database on hold - so say a random user enters data, that data is then stopped. After that, I want to be able to review the data entered and determine if it is acceptable. If the data is acceptable, I want to be able to accept the data and then have it sent to the database.Once the data is accepted, I also want to create a new web page with that data entered in a specific format. So far I have set up the form and have been able to enter the data in a database. I guess my main question at this point is how I could automatically have an email sent to myself when someone submits the form which would then allow me to preview the data before I accept it.
×
×
  • Create New...