barryman9000 Posted March 14, 2006 Share Posted March 14, 2006 Yes, I'm newer to PHP and I just took over a site that someone else built. That being said, we keep getting an error when trying to send emails:mail(): Failed to connect to mailserver at "localhost" port 25...If I make changes to the php.ini, like changing-SMTP-SMTP_Port:-sendmail_fromthe error doesn't change. I've tried setting those to our IMAP server (imap.domain.com), localhost, or I've commented them all out, but still get the same error. I've also made sure to un-comment the extension for the IMAP dll, and I've completely turned off IIS6.Any help is greatly appreciated.Apache2the newest PHPWin2003 Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 14, 2006 Share Posted March 14, 2006 Did you restart Apache after editing the php.ini file?Ken Quote Link to comment Share on other sites More sharing options...
barryman9000 Posted March 14, 2006 Author Share Posted March 14, 2006 [!--quoteo(post=354956:date=Mar 14 2006, 12:34 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 14 2006, 12:34 PM) [snapback]354956[/snapback][/div][div class=\'quotemain\'][!--quotec--]Did you restart Apache after editing the php.ini file?Ken[/quote]Yes, everytime. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 14, 2006 Share Posted March 14, 2006 If you have an imap server installed and have the imap extensions enabled in php. Then you'll want to use the [a href=\"http://uk.php.net/manual/en/function.imap-mail.php\" target=\"_blank\"]imap_mail[/a] function rather the mail function. As the mail function is only limited to SMTP email servers only. Quote Link to comment Share on other sites More sharing options...
barryman9000 Posted March 14, 2006 Author Share Posted March 14, 2006 OK, that makes sense. Can I just change the mail() function to imap_mail()? For some reason, I'm guessing it's going to be more complex than that:mail($_SESSION['member_Email'][$i], $subject, $message, "From: " . $_POST['From']); }Also, would these be the correct settings on the php.ini?; For Win32 only.SMTP = imap.domain.comsmtp_port = 25; For Win32 only.sendmail_from = imap.domain.comSince the 'From' portion of the email will be different, depending on who has logged in (login uses an email address, and a password). Or can I just use a generic email address in the .ini?I'm such a rookie... Thanks for your help Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 14, 2006 Share Posted March 14, 2006 Imap doesn't have any configuration settings in the php.ini but to send an email you first have to connect to an Imap mailbox using [a href=\"http://uk2.php.net/manual/en/function.imap-open.php\" target=\"_blank\"]imap_open[/a] once you have connected to the mailbox you should be able to use all the various imap_* functions found on the left hand side on the linked paged above. Quote Link to comment Share on other sites More sharing options...
barryman9000 Posted March 15, 2006 Author Share Posted March 15, 2006 I copied this script from the PHP site, where domain is the domain that hosts the imap server. I left out username and password, because it's going to be different every time, depending on who logged into the site. That's also where I'm getting the "From" address:$id = trim($_GET['id']); $mbox = imap_open ("{imap.domain.com:110/pop3}INBOX", "", ""); $body = imap_body($mbox,$id,$subject, $message, "From: " . $_POST['From']); print"<font face=\"verdana\" size=\"2\">$body</a>"; imap_close($mbox); I got the error "Call to undefined function: imap_open() in C:\Program Files..."Any ideas why? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.