View Full Version : PHP Email
dcajacob
02-15-2006, 07:40 PM
Hey, trying to setup an automatic email sent to the webmaster of my site, based on info typed in a form by users. I have plenty of experience with this, but Bluehost seems to block this. I was using the Mail() function. I tried the IMAP functions, with authentication, which should side-step this problem, but still no luck. It connects to the server fine and can retrieve info from my mailbox, and it says that a mail is sent successfully, but it never arrives in my box. Any ideas? This is quite annoying, considering that we are paying for php and email support...
BTW, the BlueMail CGI script that Bluehost provides (and suggests as a solution) is unacceptable.
mail() works for me perfectly, may I see the mail string you use?
arctangent
02-16-2006, 07:06 AM
Sure you are are sending to the correct address?
Simple mistakes (like me sending mail to 'yahoo.net' instead of 'yahoo.com' last week and wondering why it never got to the recipient) happen sometimes.
cfjrb
02-16-2006, 07:10 AM
Sure you are are sending to the correct address?
Simple mistakes (like me sending mail to 'yahoo.net' instead of 'yahoo.com' last week and wondering why it never got to the recipient) happen sometimes.
I send mail from php without a problem too. Could be wrong address (as above) or perhaps your mail service or client is filtering it as spam.
dcajacob
02-19-2006, 12:04 PM
Thanks for the suggestions. I am sure my code is correct. Perhaps my PHP.ini file has issues... Can one of you that has the mail function working send me an example of your code and a copy of your php.ini file? This really is a ridiculous problem and the people at Bluehost keeps giving me different answers. None of them seems to know how their servers are actually set up, what is allowed and what not.
rjewett
02-25-2006, 04:36 PM
I was using sendmail on a previous host and when I moved that over to BH the code worked without modification. And I kept the default PHP.ini that BH setup the account with.
I do not directly code the call to sendmail but use a class (class.phpmailer.php) I picked up years ago written by Brent R. Matzelle. This does a great job of encapsulating the vagaries of mail, sendmail and SMTP. If you use SMTP version you also need another class (class.smtp.php) written by Chris Ryan. They are both under LGPL license. You can find them at http://phpmailer.sourceforge.net/
I init the class as sendmail using the following PHP:
function Mailer( ) {
$this->phpmail = new phpmailer();
$this->phpmail->IsSendmail();
$this->phpmail->Host = "localhost";
}
atomicnuke
03-09-2006, 09:37 PM
What is the perk to the SMTP class or using SMTP to send in general? I'm having trouble using the mail() method to get emails through hotmail. Heard phpmailer has more success, but do you ned both classes, I saw a line if code for phpmailer that looked like isSMTP()
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.