Author Topic: PHP email transport class featuring file attachments, SMTP servers  (Read 1361 times)

Offline Guy

  • Forum addict
  • *
  • Posts: 6,118
does anyone know anything about the above

new website contact form won't work as the site is on a shared server and has the mail() function disabled

i've been in touch with my hosting peeps and they said the mail CAN be sent if I upload SMTP authentication script which is amended accordingly

they sent me through a load of sample script

now I just have to work out what script goes where and how

i'm in a pickle... can anyone help please?

Offline jamie_pyrite

  • I live here
  • *****
  • Posts: 901
Can you upload the sample script?

Offline Guy

  • Forum addict
  • *
  • Posts: 6,118
i've managed to sort it

I got back in touch with the hosting company and it appears as I am using joomla there was an easy way around it!

works perfectly now!

this is the sample script though...

http://edinburgh.theukhost.net/contact.zip

and this is a thread where someone was having the same problem... http://www.eukhost.com/forums/f34/phpmail-smtp-safe-mode-enabled-14984/

Offline The Mighty Elvi

  • I live here
  • *****
  • Posts: 2,449
  • I'm better than you today.
Sample Scripts for online contact form provided by us :
You can download the sample scripts for contact from from url below:
http://edinburgh.theukhost.net/contact.zip

The above zip file content following  Sample code and Class files
contact.php
contact.html
class.phpmailer.php
class.smtp.php.
README

Please refer  following  steps for implementing the script.
1. Copy all the files in the same folder.
2. Do not make any changes in files class.phpmailer.php and class.smtp.php.
3. Check code in contact.php file and put it into your form action file code. If action file is same

<?php
ob_start();
// File : contact.php //
require("class.phpmailer.php");

$mail = new PHPMailer();


// set mailer to use SMTP
$mail->IsSMTP();        
                                   
// specify main and backup server
$mail->Host = "smtp1.example.com";  


// turn on SMTP authentication
$mail->SMTPAuth = true;  
  
// SMTP username
$mail->Username = "user@example.com";
$mail->Password = "secret";

$mail->From = $mail->Username;
$mail->FromName = "From Name";



// Email address on which you wish to collect contact information from your site form.
// name is optional
$mail->AddAddress("to@example.com", "name");    

            
// User will be redirected to this URL after submitting the form.
$redirect_url = "";

// set word wrap to 50 characters
$mail->WordWrap = 50;                        

// set email format to HTML  
$mail->IsHTML(true);                                  

$mail->Subject = "Here is the subject";
$mail->Body    =  "Message body";


if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}
 else
 {
     echo "Message has been sent";
}
header("Location: $redirect_url");

?>