Re: Using SMTP Email Component

2009-05-17 Thread randalle2

Thanks brian for the reply here.. Actually that components works. As I
expected, the messages are only delay for few minutes. ;-)

On May 15, 1:02 pm, brian  wrote:
> On Thu, May 14, 2009 at 8:52 PM, randalle2  wrote:
> > As far as I concern... Cakephp has built-inemailcomponent, which I
> > used here.
>
> Once again: can you confirm that PHP's mail() function works as expected?
>
> If you can't send mail through a simple PHP script--and there can be
> number of reasons why you might not--then Cake's component will not
> work.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using SMTP Email Component

2009-05-14 Thread brian

On Thu, May 14, 2009 at 8:52 PM, randalle2  wrote:
> As far as I concern... Cakephp has built-in email component, which I
> used here.

Once again: can you confirm that PHP's mail() function works as expected?

If you can't send mail through a simple PHP script--and there can be
number of reasons why you might not--then Cake's component will not
work.

--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using SMTP Email Component

2009-05-14 Thread randalle2
As far as I concern... Cakephp has built-in email component, which I
used here.

On May 14, 11:18 pm, brian  wrote:
> Are you certain that a "normal" PHP script can sendemailfrom that server?
>
> On Thu, May 14, 2009 at 2:03 AM, randalle2  wrote:
>
> > Hello guys,
>
> > I need some help here... I making a contact form using Cakephp 1.2.
> > The problem upon sendingemail..The notification was successful but I
> > couldn't receive theemailIs there something wrong with my code?
> > Can anyone help me here?
>
> > Form view:
> > create("Guest" array("url"=>"controller/contact")); ?
>
> > input("Guest.name"); ?>
> > input("Guest.phone"); ?>
> > input("Guest.email"); ?>
> > input("Guest.message"); ?>// automagic lay-out.
> > ///captcha...
> > input("Guest.code"); ?>//
> >  submit("Send"); ?>
> >  end(); ?>
>
> > //controller function
> > function contact(){
> >                       // Using built in validation
> >                        if(!empty($this->data['Guest'])){
> >                        $validation = new Validation();
>
> >                        if($validation->blank($this->data["Guest"]["name"])) 
> > {
> >                                $this->Session->setFlash("Name cannot be 
> > blank.");
> >                                $this->data["Guest"]["code"] = "";
> >                        //redirect somewhre...
> >                        return;
> >                        }
> >                        
> > if($validation->blank($this->data["Guest"]["email"])) {
> >                                $this->Session->setFlash("Emailcannot be 
> > blank.");
> >                                $this->data["Guest"]["code"] = "";
> >                        //redirect somewhre...
> >                        return;
> >                        }
> >                        
> > if(!$validation->email($this->data["Guest"]["email"])) {
> >                                $this->Session->setFlash("Invalidemail.");
> >                                $this->data["Guest"]["code"] = "";
> >                        //redirect somewhre...
> >                        return;
> >                        }
> >                        
> > if($validation->blank($this->data["Guest"]["message"])) {
> >                                $this->Session->setFlash("Message cannot be 
> > blank.");
> >                                $this->data["Guest"]["code"] = "";
> >                        //redirect somewhre...
> >                        return;
> >                        }
> >                        $caseInsensitive = true;
>
> >                $val = $this->data['Guest']['code'];
>
> >                if ($caseInsensitive) {
> >                    $val = strtoupper($val);
> >                }
>
> >                if(!defined('CAPTCHA_SESSION_ID'))
> >                    define('CAPTCHA_SESSION_ID', 'php_captcha');
>
> >                if (!empty($_SESSION[CAPTCHA_SESSION_ID]) && $val ==
> > $_SESSION[CAPTCHA_SESSION_ID]) {
> >                // clear to prevent re-use
> >                unset($_SESSION[CAPTCHA_SESSION_ID]);
> >                } else {
> >                        $this->Session->setFlash("Invalid code.");
> >                        $this->data["Guest"]["code"] = "";
> >                        //redirect somewhre...
> >                        return;
> >                }
> >                        App::import('Sanitize');
> >                        $mrClean = new Sanitize();
> >                        $mrClean->clean($this->data['Guest']);
> >                        $data = $this->data['Guest'];
> >                        $this->set ( "data", $data );
> >                        $this->Email->template = 'my_email_template';
>
> >                        $settings = $this->requestAction("my own
> > server settings");
> >                        $this->set('settings', $settings);
>
> >                        // You can use customised thmls or the default ones 
> > you setup at
> > the start
>
> >                        //$this->set('data', $data);
> >                        $this->Email->to = 'emailwhere im goin send';
> >                        $this->Email->subject = 'subject';
> >                        $this->Email->bcc = array('emailwhere im goin send');
> >                        $this->Email->from = $this->data["Guest"]["name"] . 
> > " <" . $this-
> >>data["Guest"]["email"] . ">";
>
> >                        if($settings["AppModel"] == "use_smtp") {/// 
> > database config
> > settings
> >                                        /*SMTPOptions */
> >                        $this->Email->smtpOptions = array(
> >                                        'port'=> '25',
> >                                        'timeout'=> '30',
> >                                        'auth'=> true,
> >                                        'host' => 'mail.xx.com',
> >                                        'username'=> 'm...@x.com',
> >                                        'password'=> 'xx'
> >                 

Re: Using SMTP Email Component

2009-05-14 Thread brian
Are you certain that a "normal" PHP script can send email from that server?

On Thu, May 14, 2009 at 2:03 AM, randalle2  wrote:
>
> Hello guys,
>
> I need some help here... I making a contact form using Cakephp 1.2.
> The problem upon sending email..The notification was successful but I
> couldn't receive the emailIs there something wrong with my code?
> Can anyone help me here?
>
> Form view:
> create("Guest" array("url"=>"controller/contact")); ?
>>
> input("Guest.name"); ?>
> input("Guest.phone"); ?>
> input("Guest.email"); ?>
> input("Guest.message"); ?>// automagic lay-out.
> ///captcha...
> input("Guest.code"); ?>//
>  submit("Send"); ?>
>  end(); ?>
>
>
>
>
>
>
> //controller function
> function contact(){
>                       // Using built in validation
>                        if(!empty($this->data['Guest'])){
>                        $validation = new Validation();
>
>                        if($validation->blank($this->data["Guest"]["name"])) {
>                                $this->Session->setFlash("Name cannot be 
> blank.");
>                                $this->data["Guest"]["code"] = "";
>                        //redirect somewhre...
>                        return;
>                        }
>                        if($validation->blank($this->data["Guest"]["email"])) {
>                                $this->Session->setFlash("Email cannot be 
> blank.");
>                                $this->data["Guest"]["code"] = "";
>                        //redirect somewhre...
>                        return;
>                        }
>                        if(!$validation->email($this->data["Guest"]["email"])) 
> {
>                                $this->Session->setFlash("Invalid email.");
>                                $this->data["Guest"]["code"] = "";
>                        //redirect somewhre...
>                        return;
>                        }
>                        
> if($validation->blank($this->data["Guest"]["message"])) {
>                                $this->Session->setFlash("Message cannot be 
> blank.");
>                                $this->data["Guest"]["code"] = "";
>                        //redirect somewhre...
>                        return;
>                        }
>                        $caseInsensitive = true;
>
>                $val = $this->data['Guest']['code'];
>
>                if ($caseInsensitive) {
>                    $val = strtoupper($val);
>                }
>
>                if(!defined('CAPTCHA_SESSION_ID'))
>                    define('CAPTCHA_SESSION_ID', 'php_captcha');
>
>                if (!empty($_SESSION[CAPTCHA_SESSION_ID]) && $val ==
> $_SESSION[CAPTCHA_SESSION_ID]) {
>                // clear to prevent re-use
>                unset($_SESSION[CAPTCHA_SESSION_ID]);
>                } else {
>                        $this->Session->setFlash("Invalid code.");
>                        $this->data["Guest"]["code"] = "";
>                        //redirect somewhre...
>                        return;
>                }
>                        App::import('Sanitize');
>                        $mrClean = new Sanitize();
>                        $mrClean->clean($this->data['Guest']);
>                        $data = $this->data['Guest'];
>                        $this->set ( "data", $data );
>                        $this->Email->template = 'my_email_template';
>
>
>                        $settings = $this->requestAction("my own
> server settings");
>                        $this->set('settings', $settings);
>
>                        // You can use customised thmls or the default ones 
> you setup at
> the start
>
>                        //$this->set('data', $data);
>                        $this->Email->to = 'email where im goin send';
>                        $this->Email->subject = 'subject';
>                        $this->Email->bcc = array('email where im goin send');
>                        $this->Email->from = $this->data["Guest"]["name"] . " 
> <" . $this-
>>data["Guest"]["email"] . ">";
>
>                        if($settings["AppModel"] == "use_smtp") {/// database 
> config
> settings
>                                        /* SMTP Options */
>                        $this->Email->smtpOptions = array(
>                                        'port'=> '25',
>                                        'timeout'=> '30',
>                                        'auth'=> true,
>                                        'host' => 'mail.xx.com',
>                                        'username'=> 'm...@x.com',
>                                        'password'=> 'xx'
>                                        );
>
>                                $this->Email->delivery = 'smtp';
>                                }
>                                $this->Email->sendAs = 'html';
>                                $result = $this->Email->send ();
>
>                                if($resu

Using SMTP Email Component

2009-05-13 Thread randalle2

Hello guys,

I need some help here... I making a contact form using Cakephp 1.2.
The problem upon sending email..The notification was successful but I
couldn't receive the emailIs there something wrong with my code?
Can anyone help me here?

Form view:
create("Guest" array("url"=>"controller/contact")); ?
>
input("Guest.name"); ?>
input("Guest.phone"); ?>
input("Guest.email"); ?>
input("Guest.message"); ?>// automagic lay-out.
///captcha...
input("Guest.code"); ?>//
 submit("Send"); ?>
 end(); ?>






//controller function
function contact(){
   // Using built in validation
if(!empty($this->data['Guest'])){
$validation = new Validation();

if($validation->blank($this->data["Guest"]["name"])) {
$this->Session->setFlash("Name cannot be 
blank.");
$this->data["Guest"]["code"] = "";
//redirect somewhre...
return;
}
if($validation->blank($this->data["Guest"]["email"])) {
$this->Session->setFlash("Email cannot be 
blank.");
$this->data["Guest"]["code"] = "";
//redirect somewhre...
return;
}
if(!$validation->email($this->data["Guest"]["email"])) {
$this->Session->setFlash("Invalid email.");
$this->data["Guest"]["code"] = "";
//redirect somewhre...
return;
}
if($validation->blank($this->data["Guest"]["message"])) 
{
$this->Session->setFlash("Message cannot be 
blank.");
$this->data["Guest"]["code"] = "";
//redirect somewhre...
return;
}
$caseInsensitive = true;

$val = $this->data['Guest']['code'];

if ($caseInsensitive) {
$val = strtoupper($val);
}

if(!defined('CAPTCHA_SESSION_ID'))
define('CAPTCHA_SESSION_ID', 'php_captcha');

if (!empty($_SESSION[CAPTCHA_SESSION_ID]) && $val ==
$_SESSION[CAPTCHA_SESSION_ID]) {
// clear to prevent re-use
unset($_SESSION[CAPTCHA_SESSION_ID]);
} else {
$this->Session->setFlash("Invalid code.");
$this->data["Guest"]["code"] = "";
//redirect somewhre...
return;
}
App::import('Sanitize');
$mrClean = new Sanitize();
$mrClean->clean($this->data['Guest']);
$data = $this->data['Guest'];
$this->set ( "data", $data );
$this->Email->template = 'my_email_template';


$settings = $this->requestAction("my own
server settings");
$this->set('settings', $settings);

// You can use customised thmls or the default ones you 
setup at
the start

//$this->set('data', $data);
$this->Email->to = 'email where im goin send';
$this->Email->subject = 'subject';
$this->Email->bcc = array('email where im goin send');
$this->Email->from = $this->data["Guest"]["name"] . " 
<" . $this-
>data["Guest"]["email"] . ">";

if($settings["AppModel"] == "use_smtp") {/// database 
config
settings
/* SMTP Options */
$this->Email->smtpOptions = array(
'port'=> '25',
'timeout'=> '30',
'auth'=> true,
'host' => 'mail.xx.com',
'username'=> 'm...@x.com',
'password'=> 'xx'
);

$this->Email->delivery = 'smtp';
}
$this->Email->sendAs = 'html';
$result = $this->Email->send ();

if($result){
$flash = "Your inquiry has been sent. 
Thank you for contacting
us.";
$this->Session->setFlash($flash);
//redirect somewhere