Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 14th October 2010, 11:08
DKLeader DKLeader is offline
Senior Member
 
Join Date: Sep 2010
Location: Ishoej, Denmark
Posts: 113
Thanks: 6
Thanked 0 Times in 0 Posts
Default ISPConfig3 - Sending emails using PHP and Pear

First : Not sure if this goes in this part of the forum - sorry if it is misplaced.

On my multiserver setup (Debian) I am trying to get emails sent from PHP on the sites. Since all normal mail sending from PHP does not work on a multiserver system I decided to try using Pear.

My PHP file looks like this :
Code:
<?php 
   require_once "Mail.php"; 
   require_once 'Mail/mime.php'; 


   // Get user information entered on form. 
   $Kontakt_FuldtNavn = $_REQUEST['Kontakt_FuldtNavn'] ; 
   $baadnavn = $_REQUEST['baadnavn'] ; 
   $foraar = $_REQUEST['foraar'] ; 
   $efteraar = $_REQUEST['efteraar'] ; 
   $starthavn = $_REQUEST['starthavn'] ; 
   $tidligere = $_REQUEST['tidligere'] ; 
   $senestaar = $_REQUEST['senestaar'] ; 
   $Adresse = $_REQUEST['Adresse'] ; 
   $postnr = $_REQUEST['postnr'] ; 
   $by = $_REQUEST['by'] ; 
   $email = $_REQUEST['email'] ; 
   $dsklub = $_REQUEST['dsklub'] ; 
   $baadtype = $_REQUEST['baadtype'] ; 
   $skrogfarve = $_REQUEST['skrogfarve'] ; 
   $sejlnr = $_REQUEST['sejlnr'] ; 
   $lystal = $_REQUEST['lystal'] ; 
   $lgd = $_REQUEST['lgd'] ; 
   $brd = $_REQUEST['brd'] ; 
   $depl = $_REQUEST['depl'] ; 

   // Some info on who is sending. 
   $from = "24timer@24-timerssejlads.dk"; 
   $to = "24timer@24-timerssejlads.dk, $email"; 
   $subject = "24Timer - Tilmelding"; 
    
   // Some info on what smtp we are going to use. 
   $host = "mail.24-timerssejlads.dk"; 
   $username = "some@thingi.know"; 
   $password = "somethingiknow"; 
   $crlf = "\n"; 
    
// Message start 
$html = "<html> 
<body>HTML TEST MESSAGE</body> 
</html>"; 

$hdrs = array ('From' => $from, 
'To' => $to, 
'Subject' => $subject); 

$mime = new Mail_Mime($crlf); 
$mime->setHTMLBody($html); 
print_r($html); 

$body = $mime->get(); 
$headers = $mime->headers($hdrs); 

$smtp =& Mail::factory('smtp', 
array ('host' => $host, 
'auth' => true, 
'username' => $username, 
'password' => $password)); 

$mail = $smtp->send($to, $headers, $body); 
    
   if (PEAR::isError($mail)) { 
   echo("<p>" . $mail->getMessage() . "</p>"); 
   } 
?>
I have changed the message part to above during testing. I have it running on http://24-timerssejlads.dk/sendtilmeld.php

First of it seems to work fine - execpt it doesn't send any emails.
Anuone got a solution or maybe another way to send emails from within PHP using SMTP on another server.
Reply With Quote
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg Video support for ubuntu 7.10 [suphp-ispconfig] amaurib Installation/Configuration 13 16th February 2010 17:26
Installing PEAR PHP - Are there any security issues installing Pear? mxc General 2 10th July 2009 06:22
suphp pear php cat Installation/Configuration 0 3rd February 2009 19:17
PHP Open_basedir and PEAR DaddyFix Installation/Configuration 3 26th October 2006 08:11
Downgrade php5 to php4.4.2 llizards Installation/Configuration 4 13th March 2006 23:58


All times are GMT +2. The time now is 17:15.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.