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.
Recent comments
23 hours 48 min ago
1 day 9 hours ago
1 day 10 hours ago
1 day 13 hours ago
1 day 18 hours ago
1 day 18 hours ago
1 day 20 hours ago
2 days 6 hours ago
2 days 11 hours ago
2 days 13 hours ago