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

MikeyUko's avatar

I get errors when I click on the submit button

Hello to everyone in the community, I am new to PHP and Laravel. I got a source code for a support ticket project to use for my organisation and it suits a lot of purposes but I encountered some errors and would like help with that if anyone is willing to help.

  1. When I click on the submit button to submit a ticket, I get an error that says : Swift_TransportException Cannot send message without a sender address \xampp\htdocs\support-ticketing\Laravel-Support-Ticketing\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php:195. I traced the source of this code but I did not know what to change. This is the code on that line:

$this->throwException(new Swift_TransportException('Cannot send message without a sender address'));

  1. I would like to also have a REPORT option on the admin dashboard where I can generate reports and submit to a supervisor when asked. I do not how to add this option to the dashboard.

  2. Thirdly, I would like to have a notification when a ticket is submitted so I can be aware of a request.

Any help from anyone would be greatly appreciated. Thank you very much

0 likes
46 replies
Sinnbeck's avatar

Sounds like you need to configure your .env file

It should be in the root of the project files, and hold lines like these.

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

Fill out each of them with the correct information

laracoft's avatar

@mikeyuko

  1. Which version of Laravel?
  2. Older versions of Laravel needs to use MAIL_DRIVER instead of MAIL_MAILER
  3. Open config/mail.php and search for MAIL_DRIVER or MAIL_MAILER to be sure
MikeyUko's avatar

@sinnbeck I have filled the information appropriately except for MAIL_FROM_ADDRESS=null I still have that null.

@laracoft I have the MAIL_MAILER not the MAIL_DRIVER. Can the version of Laravel be determined from that?

laracoft's avatar

@mikeyuko MAIL_MAILER is probably Laravel 8. Running php artisan --version will show you the version.

MikeyUko's avatar

@sinnbeck I don't know what to put in there. Please bear with me, I'm new to all of this and I am willing to learn

Sinnbeck's avatar

Ah. Well you must have some sort of mail server that you are intending to send from.

For example, lets say that your domain is example.com. Then you might have created an email called [email protected] which you intend to handle mails to and from the website. You then put that in the MAIL_FROM_ADDRESS along with the username and password for that email address :)

[email protected]
MAIL_PASSWORD=mysecretpassword
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
1 like
raheelkhan's avatar
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

Fill any email from which you want to send the email.

MikeyUko's avatar

@sinnbeck I created the account with mailtrap.io so what should I use for the MAIL_FROM_ADDRESS or how do I find it on mailtrap.io? @raheelkhan I have done this and I still have the issue

MikeyUko's avatar

@sinnbeck : Swift_TransportException Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "

Sinnbeck's avatar

Sounds like you are using the wrong username and password

MAIL_USERNAME=1a2b3c4d5e6f7g //your username
MAIL_PASSWORD=1a2b3c4d5e6f7g // your password
MikeyUko's avatar

@sinnbeck is it allowed to share that information here? I could share what it looks like on mailtrap

MikeyUko's avatar

Okay. Thank you for the information. I am still stuck with the project

Sinnbeck's avatar

Can you show the complete .env with the username and password removed?

MikeyUko's avatar

@sinnbeck

APP_NAME=MSION-IT APP_ENV=local APP_KEY=base64:YvngKKSPN3ND/xCIS9rtaP+Yo7MEJZLx+tTOzMIYiaE= APP_DEBUG=true APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=support-ticketing DB_USERNAME=root DB_PASSWORD=

BROADCAST_DRIVER=pusher CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379

MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=null MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET=

PUSHER_APP_ID=1095035 PUSHER_APP_KEY=52f5f56b7d8f80445cb4 PUSHER_APP_SECRET=cb885b3dfdd308c08e8f PUSHER_APP_CLUSTER=eu

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

Sinnbeck's avatar

You add ``` on the line just before and after your code

MikeyUko's avatar
APP_ENV=local
APP_KEY=base64:YvngKKSPN3ND/xCIS9rtaP+Yo7MEJZLx+tTOzMIYiaE=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=support-ticketing
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=1095035
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=eu

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MikeyUko's avatar

@sinnbeck still having authentication issues. :( Is there any other way you could help me please?

Sinnbeck's avatar

I honestly have no idea why it does not work for you. I just created a test account, copy pasted the credentials into the .env file (without changing anything buth those 3 fields), and send a test email straight away

https://i.imgur.com/3lTS8YH.png

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=xxx // from that page
MAIL_PASSWORD=xxx // from that page
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
MikeyUko's avatar

@sinnbeck I just copied this code and tried again, filled up my credentials and it gave me the authentication error. Is there any other way you could help me please? Remote support perhaps?

Sinnbeck's avatar

Is the code by any chance on github so I could clone it and do a quick test?

MikeyUko's avatar

I'll upload it to github now and add you up.

MikeyUko's avatar

@sinnbeck please I would like your GitHub ID to add you up @ravish I'll add you up as well. Please like I stated earlier on, I would like to add certain features to the application to suit the need for my organisation. Thank you for the wonderful support.

Next

Please or to participate in this conversation.