Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GodziLaravel's avatar

Email settings

Hello I want to setup my email parameters in the .env file , now i'm using MailTrap and it works well , but I want to use the hosting email (inmotion hosting) the parameters are :

 Incoming Server: secure251.inmotionhosting.com
Outgoing Server: secure251.inmotionhosting.com
Username: Your full e-mail address
Password: Your e-mail account password
Incoming Port: IMAP 993
Outgoing Mail server (SMTP) Port: 465
SSL: YES
SMTP Authentication Required
Secure Authentication or SPA needs to be turned off 

how to translate this to the .env file ?

MAIL_DRIVER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
```
0 likes
3 replies
arthvrian's avatar
Level 2
MAIL_DRIVER=smtp
MAIL_HOST=secure251.inmotionhosting.com
MAIL_PORT=465
[email protected] // your full email address
MAIL_PASSWORD=password // your password
MAIL_ENCRYPTION=ssl
[email protected] // your full email address
MAIL_FROM_NAME=Your name
1 like
Cronix's avatar

In other words, set up everything using the "outgoing" settings. Your laravel app will only be sending email out, not receiving.

1 like
jimb814's avatar

My .env is configured as suggested here, but I receive an error that I cannot resolve or find any assistance for online:

Class 'Swift_StreamFilters_StringReplacementFilter' not found 

When I comment out my mail code, everything works (contact info inserted into DB). What fails is emailing the data from the form saved like this:

$data = Contact::create($validatedAttributes);

Attempting to mail:

Mail::to(request('email'))
                ->send(new ContactForm($data));

The mailable instance:

class ContactForm extends Mailable
{
    use Queueable, SerializesModels;

    public $data;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.contact-form');
    }
}

The markdown template:

@component('mail::message')
# You received a contact form submission from {{ $data->first_name }}.

Here are the details: 
- Name: {{ $data->first_name }} {{ $data->last_name }}
- Email: {{ $data->email }}
- Message: {{ $data->message }}


Thanks,<br>
{{ config('app.name') }}
@endcomponent

Everything works in MailTrap but not on the server at InMotion Hosting. Any ideas on what I'm doing wrong?

Please or to participate in this conversation.