# Error: An Internal Error Has Occurred. tried send email

**URL:** <https://discourse.cakephp.org/t/error-an-internal-error-has-occurred-tried-send-email/2657>\
**Category:** Uncategorized\
**Created:** [June 2, 2017, 3:16pm UTC](https://discourse.cakephp.org/t/error-an-internal-error-has-occurred-tried-send-email/2657 "2017-06-02T15:16:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lsepolis123](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@lsepolis123](https://discourse.cakephp.org/u/lsepolis123)\
**Post date:** [June 2, 2017, 3:16pm UTC](https://discourse.cakephp.org/t/error-an-internal-error-has-occurred-tried-send-email/2657/1 "2017-06-02T15:16:37Z")

</div>

I am getting:

CakePHP: the rapid development php framework  
An Internal Error Has Occurred  
Error: An Internal Error Has Occurred.

when un-comment lines below … I have CakePHP 3.2.1 // you know where bug is???

```
	public function emailtothis() {
        $email1 = $this->request->data('emailfield');
		$id = $this->request->data('idemail');
	
        $listing = $this->Listings->get($id, [
             'contain' => ['Users', 'Categories']
        ]);
		
		$email = new Email('default');
/* $email->setFrom(['yyyy@gmail.com' => 'yyy.town'])
		->setTo($email1)
		->setSubject($listing->name." - yyy.town")
		->send('Share from yyy.town... Name: '.$listing->name);	
		*/
		//die($email1.", ".$listing->url); // this works
		return $this->redirect('/listings/view/'.$id);
				
	}
```

---

<div class="post-metadata">

**Author:** ![lsepolis123](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@lsepolis123](https://discourse.cakephp.org/u/lsepolis123)\
**Post date:** [June 2, 2017, 3:36pm UTC](https://discourse.cakephp.org/t/error-an-internal-error-has-occurred-tried-send-email/2657/2 "2017-06-02T15:36:40Z")

</div>

```
	$email = new Email('default');
	$email->from(['yyy@gmail.com' => 'yyy.town'])
	->to($email1)
	->subject($listing->name." - yyy.town")
	->send('Share from yyy.town... Name: '.$listing->name);	

```

fixed for cakephp 3.2.1
