# Unable to send example email

**URL:** https://forum.mautic.org/t/unable-to-send-example-email/35832
**Category:** Product Support
**Created:** [June 10, 2025, 9:35pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832 "2025-06-10T21:35:29Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![emrl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/emrl/32/7000_2.png) [@emrl](https://forum.mautic.org/u/emrl)
#### Post date: [June 10, 2025, 9:35pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/1 "2025-06-10T21:35:29Z")

</div>

**Your software**  
My Mautic version is: 6.0.2  
My PHP version is: 8.3  
My Database type and version is: Ver 15.1 Distrib 10.3.39-MariaDB

**Your problem**  
My problem is:  
Sending example email does not work.

These errors are showing in the log:

```auto
[2025-06-10T21:19:51.281965+00:00] messenger.CRITICAL: Error thrown while handling message Symfony\Component\Mailer\Messenger\SendEmailMessage. Removing from transport after 3 retries. Error: "Handling "Symfony\Component\Mailer\Messenger\SendEmailMessage" failed: Connection could not be established with host "localhost:25": stream_socket_client(): Unable to connect to localhost:25 (Connection refused)" {"class":"Symfony\\Component\\Mailer\\Messenger\\SendEmailMessage","retryCount":3,"error":"Handling \"Symfony\\Component\\Mailer\\Messenger\\SendEmailMessage\" failed: Connection could not be established with host \"localhost:25\": stream_socket_client(): Unable to connect to localhost:25 (Connection refused)","exception":"[object] (Symfony\\Component\\Messenger\\Exception\\HandlerFailedException(code: 0): Handling \"Symfony\\Component\\Mailer\\Messenger\\SendEmailMessage\" failed: Connection could not be established with host \"localhost:25\": stream_socket_client(): Unable to connect to localhost:25 (Connection refused) at /srv/mautic/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php:124)\n[previous exception] [object] (Symfony\\Component\\Mailer\\Exception\\TransportException(code: 0): Connection could not be established with host \"localhost:25\": stream_socket_client(): Unable to connect to localhost:25 (Connection refused) at /srv/mautic/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:154)"} {"hostname":"REDACTED","pid":26400}

```

Steps I have tried to fix the problem:  
Cleared cache.  
Verified email DSN: smtp://USERNAME:SECRET@smtp-broadcasts.postmarkapp.com:25  
Sending test from the settings page works.

Seems others were having similar problem here (doesn’t look to be related to AWS btw): [Cannot send emails to contacts with AWS SES plugin · Issue #14584 · mautic/mautic · GitHub](https://github.com/mautic/mautic/issues/14584)

Seems that it is ignoring the DNS and trying to send from the default of localhost:25.

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [June 11, 2025, 4:35am UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/2 "2025-06-11T04:35:04Z")

</div>

Hello,  
Can you paste here an example DSN you are trying to use?  
Just replace the user:secret for your securtiy.

The plugin you mention doesn’t actually send email, but manages feedback loops.  
For sending via API you need to install:

```auto
composer require symfony/amazon-mailer

```

---

<div class="post-metadata">

### Author: ![emrl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/emrl/32/7000_2.png) [@emrl](https://forum.mautic.org/u/emrl)
#### Post date: [June 11, 2025, 4:07pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/3 "2025-06-11T16:07:59Z")

</div>

@joeyk The DSN is in my post. And I mentioned it has nothing to do with the AES mailer, which that GitHub issue also says in a comment, but the problem is same I am experiencing, any SMTP or DSN is being ignored when using the Send Example button.

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [June 11, 2025, 4:21pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/4 "2025-06-11T16:21:46Z")

</div>

Hello, sorry I missed the DSN 😕  
Do you have port 25 available on your server?  
It’s mostly blocked - and you error also suggest that.

---

<div class="post-metadata">

### Author: ![emrl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/emrl/32/7000_2.png) [@emrl](https://forum.mautic.org/u/emrl)
#### Post date: [June 11, 2025, 5:28pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/5 "2025-06-11T17:28:53Z")

</div>

@joeyk That is the problem, it should not be attempting to use localhost:25 at all. That is the default SMTP for Symfony Mailer. But I have the DSN set to [smtp-broadcasts.postmarkapp.com:25](http://smtp-broadcasts.postmarkapp.com:25).

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [June 12, 2025, 8:10am UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/6 "2025-06-12T08:10:40Z")

</div>

I’m not sure if this is resolved now.  
:25 means port 25

---

<div class="post-metadata">

### Author: ![emrl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/emrl/32/7000_2.png) [@emrl](https://forum.mautic.org/u/emrl)
#### Post date: [June 12, 2025, 7:20pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/7 "2025-06-12T19:20:23Z")

</div>

I’m not sure what you are saying. Nothing is resolved. The logs show that the mailer is trying to connect to `localhost:25`. But my DSN is set to `smtp-broadcasts.postmarkapp.com:25`, so `localhost` should not be involved with anything at all.

---

<div class="post-metadata">

### Author: ![emrl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/emrl/32/7000_2.png) [@emrl](https://forum.mautic.org/u/emrl)
#### Post date: [June 12, 2025, 7:42pm UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/8 "2025-06-12T19:42:06Z")

</div>

I just made a change to our queue service configuration file, adding full path to PHP executable, and it is now sending.

`/etc/systemd/system/mautic-messenger-worker@.service` I changed:

`ExecStart=php8.3 /srv/mautic/bin/console messenger:consume email --memory-limit=1024M`

to

`ExecStart=/usr/bin/php8.3 /srv/mautic/bin/console messenger:consume email --memory-limit=1024M`

And now emails are sending fine.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)
#### Post date: [June 14, 2025, 7:42am UTC](https://forum.mautic.org/t/unable-to-send-example-email/35832/9 "2025-06-14T07:42:55Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
