Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Building Websites with PHP Contact Form & Sending Email Sending Our Email

Afrid Mondal
Afrid Mondal
6,255 Points

email is not going to treehouse local mail

I did everything as instructed but at the end mail is not going to local treehouse mailbox. When i enter command "mail" to check incoming mail it is showing "there is no mail". What I am doing wrong???


      require __DIR__ . '/vendor/autoload.php';

      $app = new \Slim\Slim( array(
      'view' => new \Slim\Views\Twig()

      $view = $app->view();
      $view->parserOptions = array(
      'debug' => true

      $view->parserExtensions = array(
          new \Slim\Views\TwigExtension(),

     $app->get('/', function() use($app){

     $app->get('/contact', function() use($app){

      $app->post('/contact',function() use ($app){
      $name = $app->request->post('name');
      $email = $app->request->post('email');
      $msg = $app->request->post('msg');

       if(!empty($name) && !empty($email) && !empty($message)){
        $cleanName = filter_var($name, FILTER_SANITIZE_STRING);
        $cleanEmail = filter_var($email, FILTER_SANITIZE_EMAIL);
        $cleanMessage = filter_var($msg, FILTER_SANITIZE_STRING);
        } else {

       $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
       $mailer = \Swift_Mailer::newInstance($transport);

        $message = \Swift_Message::newInstance();
        $message->setSubject('Email from our website');
        $cleanEmail => $cleanName

        $result = $mailer->send($message);

         if($result > 0) {
        } else {



1 Answer

Did your var_dump in the previous task, work the same as the teachers?