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

  • SEARCH
  • Home
  • 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 7981733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:27:55+00:00 2026-06-04T10:27:55+00:00

After a battle getting the correct location for pear my code does not generate

  • 0

After a battle getting the correct location for pear my code does not generate any errors.
Yet it will not send the email. The email body is generated from a form which first enters the data into a mysql database then emails the same data to a person who then uses the data for whatever. I have read tons of questions and answers on this forum and other (this being the best) and most of the code I have written is been inspired by this forum. The gmail account is valid and the password is correct. Any help or suggestions would be very much appreciated.

pear and pear mail is installed on the server and seems to be working (at least not creating any errors)
Here is my code:

   //Email process code


   ini_set('display_errors','on');
   error_reporting(E_ALL);
   /*
   require_once 'System.php';
  if(class_exists('System')===true) {
  echo 'PEAR is installed!';
  } else {
  echo 'PEAR is not installed :(';
   }
  */

  set_include_path('/home/surfcup/php/');
  require_once "Mail.php";


  $from = "<me@gmail.com>";
  $ToEmail = "<new@apdapalabs.com>"; 


  $EmailSubject = 'Hotel Registration Form'; 

  $host ="ssl://smtp.gmail.com";
  $port ="465";
  $username = "myAccount@gmail.com";
  $password =   "password";


  $headers = array ('From' => $from, 'To'=> $ToEmail, 'Subject'=> $EmailSubject);

  $smtp = Mail::factory('smtp',
    array ('host'=> $host,
           'port'=> $port,
           'auth'=> true,
           'username'=> $username,
           'password'=> $password));

  $MESSAGE_BODY = "Event: ".$Event."\n"; 
  $MESSAGE_BODY .= "Name: ".$realname."\n"; 
  $MESSAGE_BODY .= "Age Group: ".$Age."\n"; 
  $MESSAGE_BODY .= "Sex: ".$Sex."\n"; 
  $MESSAGE_BODY .= "Contact Name: ".$Contact_Name."\n"; 
  $MESSAGE_BODY .= "Contact Email: ".$Contact_Email."\n"; 
  $MESSAGE_BODY .= "Phone: ".$Phone."\n"; 
  $MESSAGE_BODY .= "Hotel Name: ".$Hotel_Name."\n"; 
  $MESSAGE_BODY .= "No Rooms: ".$No_Rooms."\n"; 
  $MESSAGE_BODY .= "Rate: ".$Rate."\n"; 
  $MESSAGE_BODY .= "Check In Date: ".$Check_In."\n"; 
  $MESSAGE_BODY .= "Check Out Date: ".$Check_Out."\n"; 
  $MESSAGE_BODY .= "Additional Info: ".$Add_Info."\n"; 



  $mail = $smtp->send($ToEmail, $headers, $MESSAGE_BODY);


        if (PEAR::isError($mail)){
            echo("<p>" . $mail->getMessage . "</p>");
            echo("\n");
            echo("<p>" . $mail->getDebugInfo . "</p>");

        }
  • 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-06-04T10:27:57+00:00Added an answer on June 4, 2026 at 10:27 am

    Most errors I’ve seen regarding sending via GMAIL is that OpenSSL is not enabled on your own server. Check that extension is enabled in your php.ini

    (Also, can you error check “smtp” in case that fails.)

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

Sidebar

Related Questions

After using the following code no errors are shown, but my database is not
After using Instruments, I have found the a spot in my code that is
When I run the following code I'm getting an error that reads fig_match:rb:5:in '':
After receiving push notification app icon not display badge. In setting notification is on,
After I released my app, the in-app purchases list is not displaying in the
After upgrading my Rails 3.0.9 app to 3.1.1, I'm getting the following bundler error
After finding out how to manually commit a Play! JPA transaction ... I'm not
After switching from RVM to system ruby I keep getting this error. It doesn't
From what I can see Gearman does not support scheduled jobs or delayed jobs.
After following the RoR getting started tutorial, I added another model as: $ rails

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.