Skip navigation
Loftynorman
Currently Being Moderated

Emails - PHP and Dreamweaver

Apr 3, 2013 11:20 AM

I have made good progress with David Powers 'Training from the Source' until Chapter 8 - Emails.

 

I have the following message from the Mail Connector

 

Fatal error: Class 'Zend_Mail_Transport_Sendmail' not found inC:\Xampp\xampp\htdocs\phpcs5\lesson08\workfiles\scripts\mail_connector .php on line 7

 

 

The details I entered were as as follows:

 

<?php

$mailhost = 'smtp.btconnect.com';

$mailconfig = array('auth' => 'login',

'username' => 'mrwhitegrassroot@btconnect.com',

'password' => '************',

'ssl' => 'ssl');

$transport = new Zend_Mail_Transport_Sendmail('-fmrwhitegrassroot@btconnect.com');

Zend_Mail::setDefaultTransport($transport);

 

I have blotted out my password but I don't think that is the problem.

 

I currently have one active website on my remote server but that is a static site.

 

I tried to test the remote server without success probably because it is not linked up to PHP.

 

Could it be that the emails will not work until I have a remote server that is favourable to PHP?

 
Replies
  • Currently Being Moderated
    Apr 3, 2013 11:36 AM   in reply to Loftynorman

    Does your server have the ability to send email? Does it allow for secure sending?

     

    This is what I do:

     

    $todayis = date("l, F j, Y, g:i a") ;

     

     

    $subject = Contact_From_Website;

     

     

    $notes = stripcslashes($notes);

     

     

    $message = " $todayis [EST] \n

    Message: $notes \n

    From: $visitor ($visitormail)\n

    Telephone: $visitorphone ($visitorphone)\n

    Additional Info : IP = $ip \n

    ";

     

    $from = "From: $visitormail\r\n";

     

    mail("youremail@company.com", $subject, $message, $from);

     

    ?>

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Apr 3, 2013 9:19 PM   in reply to Loftynorman

    Can you add this to your code:

     

    'ssl' => 'ssl',

    'port' => '465');

    Notice I've removed closing bracket next to ssl and replaced with comma. Added Port line and included closing bracket.

     

    Also where are you calling your mail_connector.php script from? YOu should have it somewhere in your code where you say require_once or include_once... Can you post that as well for us please?

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Apr 5, 2013 12:39 AM   in reply to Loftynorman

    Since you're testing locally, you probably dont have a mailserver on your local computer - which is why you're seeing that error.

     

    Try it on your remote webserver. Or, from your local computer, change 'localhost' to a proper mailserver's IP or CNAME (mail.yourdomain.com) or something similar and test it out.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 7, 2013 11:10 AM   in reply to Loftynorman

    Moved to the Develop server-side applications in Dreamweaver forum.

     

     

    Loftynorman wrote:

     

    I have the following message from the Mail Connector

     

    Fatal error: Class 'Zend_Mail_Transport_Sendmail' not found inC:\Xampp\xampp\htdocs\phpcs5\lesson08\workfiles\scripts\mail_connector .php on line 7

    The error message tells you that the script cannot find the Zend_Mail_Transport_Sendmail class. This means that the Zend Framework is probably not in your PHP include path. See page 222 for details of how to set up the include path.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 7, 2013 11:14 AM   in reply to Loftynorman

    lofty, it looks like you are trying to use either a testing server (that is not configured to be a mail server) or your local computer to test emails.

     

    Assuming your hosting provider has a fairly standard system with complete php support, you should be using that remote server to test emails. That's what I do all the time. Any page I am working on is in a special subdirectory (or folder) called /testing/ or something else.

     

    Navigate with your browser to that page and then try it there. THAT is the server that will need to run your server-side code, not your local computer or your testing server (if it is different from your remote host). It may have a different version of php on it, it may have a php configuration file that is different. There are so many variables that it just makes sense to do it on that remote server.

     

    So, to prevent the wrong people from seeing your pages before they are ready to launch, set things up in a folder that is not accessible.

     

    Then run your email tests, your sendmail tests and so on. This is what I do for my clients. It's what works.

     

    Find out from your hosting provider what your port numbers should be in your php. Frankly, I don't call port numbers in mine, I just tell the server to send the mail; my code is posted above and it's simple.

     

    I think you'll have better luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 7, 2013 11:30 AM   in reply to mhollis55

    mhollis55 wrote:

     

    lofty, it looks like you are trying to use either a testing server (that is not configured to be a mail server) or your local computer to test emails.

    He's using my book, which uses the Zend Framework to make an SMTP connection directly to a remote mail server. If set up correctly, it should work just fine. It does not require a local mail server.

     

    Using the standard PHP mail() function does require a local mail server. The Zend Framework does not.

     

    As I pointed out earlier, the original error message says that the required class can't be found. Sort that problem, and the issue should be fixed.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points