# Laminias mail pop imap not working

**URL:** https://discourse.laminas.dev/t/laminias-mail-pop-imap-not-working/3307
**Category:** Components & MVC
**Tags:** laminas-mail
**Created:** [April 19, 2023, 2:39pm UTC](https://discourse.laminas.dev/t/laminias-mail-pop-imap-not-working/3307 "2023-04-19T14:39:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bern](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@Bern](https://discourse.laminas.dev/u/Bern)
#### Post date: [April 19, 2023, 2:39pm UTC](https://discourse.laminas.dev/t/laminias-mail-pop-imap-not-working/3307/1 "2023-04-19T14:39:54Z")

</div>

Hello,

Where is the error on this codes :

```auto
use Laminas\Mail\Storage\Pop3;
require_once 'vendor/autoload.php';

$mail = new Pop3([
    'host' => 'pop.gmail.com',
    'user' => 'xxxxxxxx@gmail.com',
    'password' => 'xxxxxxx',
	'port' => '995',
	'ssl' => 'TLS'
]);

echo $mail->countMessages() . " messages found\n";
foreach ($mail as $message) {
    printf("Mail from '%s': %s\n", $message->from, $message->subject);
}

```

thx

---

<div class="post-metadata">

### Author: ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)
#### Post date: [April 19, 2023, 5:38pm UTC](https://discourse.laminas.dev/t/laminias-mail-pop-imap-not-working/3307/2 "2023-04-19T17:38:55Z")

</div>

Are you getting an error message or what exactly is the problem?

You may also have to [allow POP3](https://support.google.com/mail/answer/7104828?hl=en) first, but you should rather use IMAP than POP3 anyway.
