# Unable to send simple email

**URL:** <https://discourse.cakephp.org/t/unable-to-send-simple-email/6908>\
**Category:** Need Help\
**Created:** [November 21, 2019, 9:40pm UTC](https://discourse.cakephp.org/t/unable-to-send-simple-email/6908 "2019-11-21T21:40:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James1](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@James1](https://discourse.cakephp.org/u/James1)\
**Post date:** [November 21, 2019, 9:40pm UTC](https://discourse.cakephp.org/t/unable-to-send-simple-email/6908/1 "2019-11-21T21:40:53Z")

</div>

Hi, I’m trying to send a simple email upon user registration. It seems that I’m following the documentation correctly, yet I do not receive the email.  
[https://book.cakephp.org/3/en/core-libraries/email.html](https://book.cakephp.org/3/en/core-libraries/email.html)

use Cake\Mailer\Email;

class UsersController extends AppController

{

```
public function register(){
    $user = $this->Users->newEntity();
    if($this->request->is('post')){
        $user = $this->Users->patchEntity($user, $this->request->getData());
        if($this->Users->save($user)){
            $this->Flash->success('You are registered and can login');

            // Send email
            $email = new Email('default');
            $email->setFrom(['testAdmin@xtra.co.nz' => 'Bargin Books'])
                ->setTo('test123@xtra.co.nz')
                ->setSubject('Registration')
                ->send('Welcome to Bargin Books');

            return $this->redirect(['action' => 'login']);
        }else{
            $this->Flash->error('You are not registered');
        }
    }
    $this->set(compact('user')); //users?
    $this->set('_serialzie', ['user']);
}

```

}

I appreciate your help

---

<div class="post-metadata">

**Author:** ![James1](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@James1](https://discourse.cakephp.org/u/James1)\
**Post date:** [November 21, 2019, 9:46pm UTC](https://discourse.cakephp.org/t/unable-to-send-simple-email/6908/2 "2019-11-21T21:46:03Z")

</div>

Oh well, it works with an @gmail.com account, though not an @xtra.co.nz account.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [November 21, 2019, 11:14pm UTC](https://discourse.cakephp.org/t/unable-to-send-simple-email/6908/3 "2019-11-21T23:14:52Z")

</div>

Are you using the Mail transport, or SMTP? If the latter, what server are you sending through? This seems very much like a restriction outside of Cake.
