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 7187961
In Process

The Archive Base Latest Questions

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

I have an application I am developing where the user is allowed to email

  • 0

I have an application I am developing where the user is allowed to email the article he/she is viewing. I am using Ajax to process this. Basically the user adds his/her email/name and the email of person the message is supposed to be sent to. I am having a problem passing an array of data to my cakephp function. The data is being placed in the array accurately, but I cannot see it in my CakePHP function specifically the email that is being sent.

My Javascript Code

 var dataString = new Array();
            dataString[0] = name;
            dataString[1] = email;

    // This will display Joe Schmoe, email@domain.com
    alert(dataString); return false;

        $('#contact-area').html("<div id='Sending' style='margin-left:410px;color:red;border:1px solid red'>Enviando...Por favor, aguarde um momento!</div>");


    $.ajax({
  type: "POST",
  url: "/articles/enviar",
  data: dataString,
  success: function() {
    $('#Sending').hide();
    $('#contact-area').html("<div id='message' style='margin-left:410px;color:red;border:1px solid red'></div>");
    $('#message').html("<h3>A Sua Mensagem Ja Foi Enviada!</h3>")
    .append("<p>Obrigado.</p>")
    .hide()

My Controller Action

function enviar(){  
//debug($emailInfo);
        // Send email with new password
    $this->Email->to = 'xxxxxxx@yahoo.com';//testing without array
    $this->Email->subject = 'Hello';//$emailInfo['name'].' - Noticia Na Bravanews';
    $this->Email->from = 'xxxxxx@bravanews.com';//testing without array
$this->Email->sendAs = 'html';
$this->Email->template = 'enviar_email';
$this->Email->smtpOptions = array(
    'port'=>'465',
    'timeout'=>'30',
    'host' => 'ssl://smtp.gmail.com',
    'username'=>'xxxxx@gmail.com',
    'password'=>'xxxxxxxx'
);
$this->Email->delivery = 'smtp';


    // this displays as nothing
$this->set('emailInfo', $this->data);


if($this->Email->send()){
    return true;
}else{
    return false;
}
}

And my email template

Hello,<br />
<?php e($emailInfo[0]); ?> sugeriu que leias a seguinte notícia na Bravanews.<br>
<?php e($emailInfo[1]); ?><br>
Por favor clique no link abaixo:<br /><br>
<?php debug($emailInfo); ?>

How do I go about fixing this issue. I cannot transpose anything to the email template so I can print or email…

  • 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-28T18:57:47+00:00Added an answer on May 28, 2026 at 6:57 pm

    You must send variables in an array named data so that you can find them in $this->data.

    Else in CakePHP 1.3 you can not pass parameters to the view by using the $this->set(). For me I create my own component based on the Email CakePHP component to give the possibility to pass parameters to the view.

           data : {'data[Model][email]' : email, 'data[Model][name]' : name},
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this application I'm developing in JSP and I wish to export some
I have a simple application using netbeans for developing and maven for building et
I have an application which I am developing using WPF\Prism\MVVM. All is going well
i'm developing an application (wpf) that have 3 windows. in the main window user
I'm currently developing a new web application. This is the first time I'm using
I have begun developing an application using the Entity Framework. I have added a
I am developing an asp.net mvc application and have created my custom user database
I have PHP application for offers. In this application when user log in I
In the iPhone application I'm developing, I have a need to return the user
I am developing a rails application in which I have two models User and

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.