Illasera Posted July 6, 2010 Share Posted July 6, 2010 Hello my lords...Now am trying to send mail via my Online website,I have a mail server that sends Authentication mails, That i pay a nice amount for, I have my :mail@website_domainusername and passwordAnd the mail providers arent blacklisted anywhere afaik and experienced with.I wanted to know : 1.)how is the mail() function is any different then the PEAR::send/factory functions (I really can`t understand anything from the documentations, Maybe smaller (simple/generic explanation will do the trick)?2.)What pear actually is (If i understand correctly, some sort of framework extension based on PHP)?3.)How do i know if my hosting website server has PEAR installed. (What should i look for in phpinfo()?4.)And what could cause a simple code like this crash (Stop running/rendering) Once it hits the sendmail function (php5.1.6)?4.***.)Please note that parameters i have in my orignal code are validated and cansored here. if($_POST['sendpass']){ $from = "user@mail_provider"; $to = "testuser@hotmail.com"; $subject = "Test subject"; $body = "Test body"; $host = "mail.mailserver.provider"; $username = "user@mail_provider"; $password = "password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); // Crashes in the mail::factory function. php 5.1.6 , No error reported $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); // Crashes here as well php 5.1.6 No error reported $mail = $smtp->send($to, $headers, $body);?> Thanks in advance. Link to comment Share on other sites More sharing options...
boen_robot Posted July 6, 2010 Share Posted July 6, 2010 1. PEAR::Mail abstracts away the different portions of an email message, in order to keep things more convinient and secure. I mean... what's easier - having one big long unreadable and potentially unsafe string, or a few lines of function calls that generate the long unreadable string in a safe fashion?2. It's a collection of high quality PHP classes, designed to make various stuff more convinient.3. Since we're talking about plain PHP files, and not some binary files that would modify phpinfo(), there's no way to verify if you have the PEAR installer without actually trying to use it. Even without it though, you may be able to install PEAR classes... the best way to see how/if you can install PEAR packages is to ask your host.4. Normally, I'd say lacking a mail server, but in your case... I don't see you specifying that you use SMTP, or is the server a sendmail server? If you use SMTP (which basically means everything other than sendmail), you need to somehow specify that you're using it.I'd reccomend Zend_Mail btw. It works on the same premise, but it's more sophisticated and convinient (IMO). To install it and use it, all you need to do is place the Zend folder from the framework archive at an accessible folder, and include the "Zend/Mail.php" file. Link to comment Share on other sites More sharing options...
Illasera Posted July 7, 2010 Author Share Posted July 7, 2010 1. PEAR::Mail abstracts away the different portions of an email message, in order to keep things more convinient and secure. I mean... what's easier - having one big long unreadable and potentially unsafe string, or a few lines of function calls that generate the long unreadable string in a safe fashion?2. It's a collection of high quality PHP classes, designed to make various stuff more convinient.3. Since we're talking about plain PHP files, and not some binary files that would modify phpinfo(), there's no way to verify if you have the PEAR installer without actually trying to use it. Even without it though, you may be able to install PEAR classes... the best way to see how/if you can install PEAR packages is to ask your host.4. Normally, I'd say lacking a mail server, but in your case... I don't see you specifying that you use SMTP, or is the server a sendmail server? If you use SMTP (which basically means everything other than sendmail), you need to somehow specify that you're using it.I'd reccomend Zend_Mail btw. It works on the same premise, but it's more sophisticated and convinient (IMO). To install it and use it, all you need to do is place the Zend folder from the framework archive at an accessible folder, and include the "Zend/Mail.php" file.Am using SMTP and i dont see in the ZEND example, in the sendmailer.php that you can send via SMTP...About PEAR now for a sec,My server provider said he can`t install pear because they dont support it, is there a way to do without them? Link to comment Share on other sites More sharing options...
boen_robot Posted July 7, 2010 Share Posted July 7, 2010 There is a way to do it without a PEAR class - Zend_Mail is just one such way. If you search for "PHP mail", you'll probably find more than the mail() function.There is SMTP. There's even support for SMTP authentication, which is what you're using. Link to comment Share on other sites More sharing options...
Illasera Posted July 7, 2010 Author Share Posted July 7, 2010 There is a way to do it without a PEAR class - Zend_Mail is just one such way. If you search for "PHP mail", you'll probably find more than the mail() function.There is SMTP. There's even support for SMTP authentication, which is what you're using.Thanks, My server hosting providers sais that zend is installed,But i have no idea where can i find these files i need to include and what files i need to include if any,The documentation isnt really friendly.. Link to comment Share on other sites More sharing options...
boen_robot Posted July 7, 2010 Share Posted July 7, 2010 Thanks, My server hosting providers sais that zend is installed,But i have no idea where can i find these files i need to include and what files i need to include if any,The documentation isnt really friendly..Your server doesn't need to support anything. Your host probably confused the Zend Framework with the Zend Engine (i.e. PHP).Like I said, download the archive, and extract it at your host. Then include "Zend/Mail.php". Link to comment Share on other sites More sharing options...
Illasera Posted July 7, 2010 Author Share Posted July 7, 2010 Your server doesn't need to support anything. Your host probably confused the Zend Framework with the Zend Engine (i.e. PHP).Like I said, download the archive, and extract it at your host. Then include "Zend/Mail.php".It worked, Thank you, Love you ! 2 days of trying to solve it and , well, YOU DID IT ! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.