Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 773389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:57:22+00:00 2026-05-14T18:57:22+00:00

Hi guys for some weird reason I’m unable to send email using zend mail

  • 0

Hi guys for some weird reason I’m unable to send email using zend mail 🙁 – I keep getting the following error:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in /home/fltdata/domains/fltdata.com/public_html/admin/g-app/includes/mailer.php on line 77

Below is my code:

if($_POST):

    $fields = array('to', 'cc', 'bcc', 'subject', 'body');
    $req_fields = array('to', 'subject', 'body');

    foreach($fields as $vv)
    {
        if( ($_POST[$vv]=='')&&(in_array($vv, $req_fields)) ):
            $errors[$vv] = strtoupper($vv.' is required');
        else:
            $$vv = $_POST[$vv];
        endif;
    }

    if(count($errors)==0):

        $to = explode(',', $_POST['to']);
        $cc = explode(',', $_POST['cc']);
        $bcc = explode(',', $_POST['bcc']);

        //check if the emails are valid
        foreach($to as $one_email)
        {
            if(!is_valid_email($one_email)):
                $errors['to'].= $one_email.' is not a valid email<br/>';
            endif;
        }

        foreach($cc as $one_email)
        {
            if(!is_valid_email($one_email)):
                $errors['cc'].= $one_email.' is not a valid email<br/>';
            endif;
        }

        foreach($bcc as $one_email)
        {
            if(!is_valid_email($one_email)):
                $errors['bcc'].= $one_email.' is not a valid email<br/>';
            endif;
        }
    endif;

    if(count($errors)==0):
        $config = array(    'auth' => 'login', 
                                'username' =>$current_dept->email, 
                                'password' => $current_dept->email_psd );

        $transport = new Zend_Mail_Transport_Smtp($current_dept->outgoing_server, $config);
        Zend_Mail::setDefaultFrom($current_dept->email, _get_session('name'));
        Zend_Mail::setDefaultReplyTo($current_dept->email);

        $mail = new Zend_Mail();
        $mail->addTo($to);

        if(count($cc)>0)
            $mail->addCc($cc);

        if(count($bcc)>0)
            $mail->addBcc($bcc);

        $mail->setSubject($subject);
        $mail->setBodyText($body);

        try{
        ($mail->send($transport));
        } catch($e){ // this is line 77 but wheres the error?
            echo 'OUCH';
        }

    endif;

endif;

The line which the parser states only has a catch statement – wheres the error here please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:57:23+00:00Added an answer on May 14, 2026 at 6:57 pm

    Instead of catch($e){ use

    catch (Exception $e) {
    

    see http://docs.php.net/language.exceptions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I'm getting a syntax error on my CONCATS for some reason, this
Guys check this website on FF and Chrome For some reason(s), jQuery isn't working
I have been getting some weird errors when I upgrade jQuery from 1.4.4 to
I am testing some weird-looking CSS code that I wrote (I'm using a mix
In the last weeks I've seen some guys using really long names for a
I keep on hearing about concurrent programing every where. Can you guys throw some
Some guys where I work are setting up a new database server for SQL
I've been making heavy use of the interactive 3D controls, made by some guys
I hope some of you guys can help me with this problem.... I have
Guys i have a WebView in my Screen with some TextFields in it. Whenever

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.