Skip to content

Mailgun Driver Fails to Read Message Attachments #50446

Closed as not planned
Closed as not planned
@nanoray8888

Description

@nanoray8888

Symfony version(s) affected

"symfony/mailgun-mailer": "^6.2"

Description

I have encountered a strange issue when sending an email with an attachment via the Mailgun driver. When attempting to attach a small image with a size of around 10kb to 20kb, the email sends successfully. However, when I tried attaching an image with a size of approximately 100kb, I received an error response.

Unable to send an email: unable to read message attachment: unexpected EOF (code 400).

The strange thing is that this issue is occurring only on the M1 MacBook machine. When I tested the same code with the same attachments on an Intel MacBook Pro, it worked properly.

Has anyone else experienced a similar problem on the M1 Mac Pro?

Framework: Laravel 10
PHP: 8.2
"symfony/mailgun-mailer": "^6.2"
"symfony/http-client": "^6.2",

How to reproduce

// App\Mail\TestMail

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class TestMail extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Test Mail',
        );
    }

    /**
     * Get the message content definition.
     */
    public function content(): Content
    {
        return new Content(
            view: 'test',
        );
    }

    /**
     * Get the attachments for the message.
     *
     * @return array<int, \Illuminate\Mail\Mailables\Attachment>
     */
    public function attachments(): array
    {
        return [
            Attachment::fromPath(storage_path('testpng.png')),
        ];
    }
}

// Route

Route::get('test', function() {
    Mail::to('to@example.test)->send(new TestMail);
});

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions