Hello,

I have similar problem with email component - php mail function works
fine but Cake can't send email through built-in component.
Here is debug output::

To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Subject: Query from website
Header:

From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
X-Mailer: CakePHP Email Component
Content-Type: multipart/alternative; boundary="alt-"

Content-Transfer-Encoding: 7bitParameters:

Message:

--alt-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Query from
Email
Phone

Query

--alt-
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit




Query from
Email:
Phone

Query
        --alt---

And here is the content of my controller:

function send($id=null){

                $this->layout='small';

                if(!empty($this->data['Question'])){
                        $this->Question->set($this->data['Question']);
                        if($this->Question->validates()){
                                if(!empty($this->data['Question']['id'])){
                                        
$this->Question->bindModel(array('belongsTo'=>array('Offer')));
                                        $this->Question->Offer->set('id', 
$this->data['Question']['id']);
                                        if($this->Question->Offer->exists()){
                                                
$this->data['Question']['about']=$id;
                                        }
                                        else{
                                                
unset($this->data['Question']['about']);
                                        }
                                }

                                $this->Email->to='[EMAIL PROTECTED]';
                                
$this->Email->replyTo=$this->data['Question']['email'];
                                
$this->Email->from=$this->data['Question']['email'];
                                $this->Email->subject='Query from website';
                                $this->Email->sendAs='both';
                                $this->Email->template='default';
                                $this->Email->layout='default';
                                $this->Email->delivery='mail';
                                $this->set('Question', $this->data['Question']);

                                if($this->Email->send()){
                                        
$this->Session->setFlash(__('Successful_query', true));
                                        $this->render('/questions/send', 
'small');
                                }
                                else{
                                        
$this->Session->setFlash(__('Email_problem', true));
                                        $this->render('/questions/send', 
'small');
                                }


                        }
                        else{
                                $this->render('/questions/send', 'small');
                        }
                }
                else{
                        $this->data['Question']['about']=$id;
                        $this->render('/questions/send', 'small');
                }

        }

Any suggestions ???


On Jul 1, 1:16 am, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
> Ok, thanks for the help.  I'm not sure yet if I am going to switch or
> not yet, as it does work kinda, just not all the way.  Probably will
> later actually
>
> Thanks,
> Jonah
>
> On Jun 30, 3:07 pm, r0mk1n <[EMAIL PROTECTED]> wrote:
>
> > no, you can use it anywhere you want ( with correct options of
> > course )
>
> > On Jul 1, 1:03 am, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>
> > > Question, will using SMTP as you suggested still work once I upload it
> > > to dreamhost?
>
> > > On Jun 30, 3:00 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>
> > > > I can use mail() with localhost.  I set up the php.ini to do it and it
> > > > works fine.  I also got it to work with theemailcomponent, but only
> > > > if I don't contain < or > characters, that is my problem.
>
> > > > On Jun 30, 2:55 pm, r0mk1n <[EMAIL PROTECTED]> wrote:
>
> > > > > this string "$this->smtpOptions ..... " must be:
> > > > > $this->Email->smtpOptions = array(  'port'=> 25, 'host' =>
> > > > > 'yourSMTPServer', 'username'=>'yourUserName',
> > > > > 'password'=>'yourSMTPPassword', 'timeout' => 30 );
>
> > > > > Sorry :(
>
> > > > > On Jul 1, 12:53 am, r0mk1n <[EMAIL PROTECTED]> wrote:
>
> > > > > > you are trying tosendvia PHPs mail function ( default method in
> > > > > >Emailcomponent ), but you can`t do it from localhost ;)
> > > > > > better way -sendvia SMTP
>
> > > > > > 1. you need to setup smtp delivery:
>
> > > > > > $this->Email->delivery = 'smtp';
>
> > > > > > 2. setup SMTP params:
>
> > > > > > $this->smtpOptions = array(  'port'=> 25, 'host' => 
> > > > > > 'yourSMTPServer',
> > > > > > 'username'=>'yourUserName', 'password'=>'yourSMTPPassword', 
> > > > > > 'timeout'
> > > > > > => 30 );
>
> > > > > > 3. Sending .... ;)
>
> > > > > > To get SMTP settings you need to getemailrelay information from your
> > > > > > hosting support (server, username and password)
>
> > > > > > P.S. with standart component you can`tsendyour emails via relay
> > > > > > servers that using TLS or SSL connections ( like gmail.com ), to do
> > > > > > this you need using some like ShiftMailer
>
> > > > > > On Jun 30, 11:14 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Update:  I figured out I can get it to work if I remove all < and 
> > > > > > > >
>
> > > > > > > $this->Email->from = 'No Reply <noreply@'.env('HTTP_HOST').'>';
> > > > > > > $this->Email->replyTo = No Reply '<noreply@'.env('HTTP_HOST').'>';
> > > > > > > $this->Email->return = No Reply '<noreply@'.env('HTTP_HOST').'>';
>
> > > > > > > changed to this:
>
> > > > > > > $this->Email->from = 'noreply@'.env('HTTP_HOST');
> > > > > > > $this->Email->replyTo = 'noreply@'.env('HTTP_HOST');
> > > > > > > $this->Email->return = 'noreply@'.env('HTTP_HOST');
>
> > > > > > > Now it works, but of course now I can't supply a name.  Is there a
> > > > > > > better solution?
>
> > > > > > > On Jun 30, 12:09 am, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Ok, I went through theemailcomponent code and removed the '@' 
> > > > > > > > sign
> > > > > > > > from the mail function to show error messages, and so now it 
> > > > > > > > gives
> > > > > > > > this error:
>
> > > > > > > > Warning (2): mail() [function.mail]: SMTP server response: 550 
> > > > > > > > 5.1.0
> > > > > > > > <=?UTF-8?B??= <[EMAIL PROTECTED]>> '@' or '.' expected after 
> > > > > > > > '=?UTF-8?
> > > > > > > > B??=' [CORE\cake\libs\controller\components\email.php, line 667]
>
> > > > > > > > And this is what it ran (I put a little echo in it to see what 
> > > > > > > > it was
> > > > > > > > putting into the mail() function) to get the error:
> > > > > > > > mail(poppitypopATgmailDOTcom, =?UTF-8?B?
> > > > > > > > V2VsY29tZSB0byBvdXIgcmVhbGx5IGNvb2wgdGhpbmc=?=, content stuff 
> > > > > > > > here ,
> > > > > > > > From: =?UTF-8?B??= Reply-To: =?UTF-8?B??= Return-Path: 
> > > > > > > > =?UTF-8?B??= X-
> > > > > > > > Mailer: CakePHPEmailComponent Content-Type: text/plain;
> > > > > > > > charset=UTF-8 Content-Transfer-Encoding: 7bit, )'
>
> > > > > > > > So I conclude the problem is the ?UTF-8?B??.  Which is probably
> > > > > > > > something I can not fix myself.  This is a bug.  Could someone 
> > > > > > > > make a
> > > > > > > > ticket for this?  hehe, I really have no idea how to use trac,
> > > > > > > > otherwise I would do it myself...
>
> > > > > > > > On Jun 28, 5:11 am, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > Note the "=?UTF-8?B??=" bits. There seems to be a lot of that 
> > > > > > > > > going
> > > > > > > > > on. I don't know if anyone's figured out the cause yet but I 
> > > > > > > > > suggest
> > > > > > > > > you check Trac.
>
> > > > > > > > > On Fri, Jun 27, 2008 at 11:19 PM, Turnquist, Jonah <[EMAIL 
> > > > > > > > > PROTECTED]> wrote:
>
> > > > > > > > > > I am having a problem with theemailcomponent.  I am trying 
> > > > > > > > > > to get it
> > > > > > > > > > tosenda simple textemail.  I have set up the layouts and
> > > > > > > > > > templates.  But for some reason it will notsend.  nor will 
> > > > > > > > > > it throw
> > > > > > > > > > an error.  I am using WAMP, and set up the php.ini 
> > > > > > > > > > tosendemail
> > > > > > > > > > correctly as far as I can tell.  The funny thing is that 
> > > > > > > > > > the php
> > > > > > > > > > mail() function DOES work, just not theemailcomponent.
> > > > > > > > > > Here is the code in the 
> > > > > > > > > > controller:http://bin.cakephp.org/view/2104639841
> > > > > > > > > > could somone glance at it?
>
> > > > > > > > > > Thanks,
> > > > > > > > > > Jonah
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to