jftejeiro Posted April 14, 2021 Report Posted April 14, 2021 (edited) I need help to configure the email # EMAIL SETTINGS # Look at the available mail configs in config / mail.php # Also refer to the Laravel docs here: https://laravel.com/docs/8.x/mail MAIL_DRIVER = smtp MAIL_FROM_NAME = 'phpVMS DOES NOT RESPOND' MAIL_FROM_ADDRESS = 'MY MAIL GOES HERE' MAIL_HOST = 'here goes the host, but I don't know which one to put smtp.hostinger.es, imap.hostinger.es, hostinger.es' MAIL_PORT = '587' or '995' if outbound or inbound MAIL_ENCRYPTION = MAIL_USERNAME = my username MAIL_PASSWORD = my password I tried various convinations but none of them work for me. My service provider is hostinger.es imap.hostinger.es 993 smtp.hostinger.es 587 pop.hostinger.es 995 The HOST mail I do not know what to put, because I tried with everyone and I do not receive emails when a pilot is registered. And another thing that I have doubt is if the values are between '' or without them. And I can't get users to receive an email when they sign up Edited April 14, 2021 by jftejeiro Quote
DisposableHero Posted April 14, 2021 Report Posted April 14, 2021 (edited) On 4/14/2021 at 11:17 AM, jftejeiro said: I need help to configure the email And I can't get users to receive an email when they sign up Expand # EMAIL SETTINGS # Look at the available mail configs in config/mail.php # Also refer to the Laravel docs here: https://laravel.com/docs/8.x/mail MAIL_DRIVER='smtp' MAIL_FROM_NAME='Your VA Name maybe' MAIL_FROM_ADDRESS='noreply@yoursite.com' // MAKE A NEW EMAIL WITH HOSTINGER MAIL CONTROL PANEL AND USE IT HERE MAIL_HOST='smtp.hostinger.es' MAIL_PORT=587 MAIL_ENCRYPTION= MAIL_USERNAME='noreply@yoursite.com' // SAME EMAIL USED ABOVE MAIL_PASSWORD='password for that email' I think this will work You are sending email so you need smtp and outbound port ... If above does not work, try MAIL_ENCRYPTION='tls' Edited April 14, 2021 by DisposableHero Quote
jftejeiro Posted April 14, 2021 Author Report Posted April 14, 2021 Nothing, I can't. This is what I put. I put it with two different email addresses, but nothing Tomorrow I will try another little # EMAIL SETTINGS # Look at the available mail configs in config / mail.php # Also refer to the Laravel docs here: https://laravel.com/docs/8.x/mail MAIL_DRIVER = smtp MAIL_FROM_NAME = 'MundoAirlines GO - DO NOT ANSWER' MAIL_FROM_ADDRESS='noreply@mundoairlines.com ' MAIL_HOST = 'smtp.hostinger.es' MAIL_PORT = 587 MAIL_ENCRYPTION = MAIL_USERNAME='noreply@mundoairlines.com ' MAIL_PASSWORD = 'My pass' Quote
DisposableHero Posted April 14, 2021 Report Posted April 14, 2021 what is the error in your laravel/phpvms log ? ( check your log from storage/logs folder, there should be some error about mails ) did you tried MAIL_ENCRYPTION='tls' Quote
jftejeiro Posted April 15, 2021 Author Report Posted April 15, 2021 On 4/14/2021 at 3:46 PM, DisposableHero said: # EMAIL SETTINGS # Look at the available mail configs in config/mail.php # Also refer to the Laravel docs here: https://laravel.com/docs/8.x/mail MAIL_DRIVER='smtp' MAIL_FROM_NAME='Your VA Name maybe' MAIL_FROM_ADDRESS='noreply@yoursite.com' // MAKE A NEW EMAIL WITH HOSTINGER MAIL CONTROL PANEL AND USE IT HERE MAIL_HOST='smtp.hostinger.es' MAIL_PORT=587 MAIL_ENCRYPTION= MAIL_USERNAME='noreply@yoursite.com' // SAME EMAIL USED ABOVE MAIL_PASSWORD='password for that email' I think this will work You are sending email so you need smtp and outbound port ... If above does not work, try MAIL_ENCRYPTION='tls' Expand I am making a record myself of a pilot to test. We are three administrators and the email does not reach any of the three. If that probe MAIL_ENCRYPTION = 'tls' and it doesn't work either I copied a part of the LOG, and from the registration request the LOG puts this: [2021-04-14 22:50:03] prod.INFO: Migrations available: 0 [2021-04-14 22:50:18] prod.INFO: User MDN0111 state changing from Pending to Active [2021-04-14 22:50:18] prod.INFO: NotificationEvents::onUserStateChange: New user state=1 [2021-04-14 22:50:18] prod.EMERGENCY: Error emailing user, MDN0111=XXXXXX@yahoo.es, error=Mailer [mail] is not defined. [2021-04-14 22:54:04] prod.INFO: Set pilot ID for user 33 to 111 [2021-04-14 22:54:04] prod.INFO: NotificationEvents::onUserRegister: MDN0111 is Pending, sending active email [2021-04-14 22:54:04] prod.EMERGENCY: Error emailing admin (XXXXXXX@mundoairlines.com). Error=Mailer [mail] is not defined. [2021-04-14 22:54:04] prod.EMERGENCY: Error emailing admin (XXXXXX@gmail.com). Error=Mailer [mail] is not defined. [2021-04-14 22:54:04] prod.EMERGENCY: Error emailing admin (XXXXXX@miscorreos.net). Error=Mailer [mail] is not defined. [2021-04-14 22:54:04] prod.EMERGENCY: Error emailing user, MDN0111=XXXXXX@yahoo.es, error=Mailer [mail] is not defined. [2021-04-14 22:54:04] prod.INFO: User registered: {"id":33,"pilot_id":111,"name":"ManoloCaracol","email":"XXXXXX@yahoo.es","airline_id":"1","rank_id":"1","country":"es","home_airport_id":"EDDT","curr_airport_id":"EDDT","last_pirep_id":null,"flights":0,"flight_time":0,"transfer_time":0,"avatar":null,"timezone":"GMT","status":0,"state":0,"toc_accepted":true,"opt_in":true,"active":null,"last_ip":null,"created_at":"2021-04-14T22:54:04.000000Z","updated_at":"2021-04-14T22:54:04.000000Z","deleted_at":null,"journal":{"id":35,"ledger_id":null,"type":"1","balance":{"App\\Support\\Money":"€0,00"},"currency":"EUR","morphed_type":"App\\Models\\User","morphed_id":"33","created_at":"2021-04-14T22:54:04.000000Z","updated_at":"2021-04-14T22:54:04.000000Z"},"rank":{"id":1,"name":"Piloto IFR","image_url":"public/assets/img/ranks/1.png","hours":0,"acars_base_pay_rate":"50.00","manual_base_pay_rate":"20.00","auto_approve_acars":null,"auto_approve_manual":null,"auto_promote":true,"auto_approve_above_score":"0","auto_approve_score":null,"created_at":null,"updated_at":"2021-04-14T18:28:01.000000Z"},"airline":{"id":1,"icao":"MDN","iata":"MDN","name":"MundoAirlines VA","country":"es","logo":"/public/assets/img/logo.png","active":true,"total_flights":0,"total_time":0,"created_at":"2021-04-13T14:14:45.000000Z","updated_at":"2021-04-13T16:36:09.000000Z"}} [2021-04-14 22:54:15] prod.INFO: Migrations available: 0 [2021-04-14 22:55:09] prod.INFO: User MDN0111 state changing from Pending to Active [2021-04-14 22:55:09] prod.INFO: NotificationEvents::onUserStateChange: New user state=1 [2021-04-14 22:55:09] prod.EMERGENCY: Error emailing user, MDN0111=XXXXXX@yahoo.es, error=Mailer [mail] is not defined. Quote
DisposableHero Posted April 15, 2021 Report Posted April 15, 2021 On 4/15/2021 at 11:52 AM, jftejeiro said: [2021-04-14 22:55:09] prod.EMERGENCY: Error emailing user, MDN0111=XXXXXX@yahoo.es, error=Mailer [mail] is not defined. Expand That last line gives the clue ... You are trying to use smtp, by editing the env.php file but it is not being read by your phpvms and it still tries to use the default mail function (probably from config/mail.php). What i can think of is; 1. You did not updated your phpvms and still using something old (but trying to use env.php) 2. You tried to update your phpvms but it was not finished or completed or the migration failed (visit admin area after uploading files or just visit yoursite.com/update) 3. Your files under config folder are not updated (or somehow reverted back to older coppies) and your config/mail.php is not reading the env.php file properly. Rest is up to the developer @Nabeel, he may give you more details or support about this. Quote
jftejeiro Posted April 15, 2021 Author Report Posted April 15, 2021 The config / mail.php, do I have to configure it? figure this host: 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'default' => env('MAIL_DRIVER', 'smtp'), 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, ], Quote
DisposableHero Posted April 15, 2021 Report Posted April 15, 2021 On 4/15/2021 at 3:16 PM, jftejeiro said: The config / mail.php, do I have to configure it? Expand Normally not. I am really out of suggestions, there is something strange and wrong going on your install ... Please do open a bug report (at GitHub), attach your laravel logs, config details etc and request support from developer himself. (He may be busy but he will know and help better for sure) Quote
William Posted January 18, 2022 Report Posted January 18, 2022 (edited) Need a bit of help with the email config as well as it does not seem to work properly. I signed up for Mailgun and they gave me 2 options: API or SMTP Couldn't really follow the explanation in the phpvms docs (as I do not know where to find the "Secret" as shown below) [quote] To use Mailgun, set your env.php like: MAIL_MAILER=mailgun MAILGUN_DOMAIN='your mailgun domain' MAILGUN_SECRET='your mailgun secret', [quote] so I choose SMTP and configured the ENV.php as follows: MAIL_MAILER='mailgun' MAIL_FROM_NAME='American Virtual Admin' MAIL_FROM_ADDRESS='admin@americanva.org' MAIL_HOST= 'smtp.mailgun.org' MAIL_PORT='587' MAIL_ENCRYPTION= 'TLS' MAIL_USERNAME= 'postmaster@americanva.org' MAIL_PASSWORD= 'our password' No joy. What am I missing please? Edited January 18, 2022 by William Quote
DisposableHero Posted January 18, 2022 Report Posted January 18, 2022 On 1/18/2022 at 6:38 PM, William said: Need a bit of help with the email config as well as it does not seem to work properly. I signed up for Mailgun and they gave me 2 options: API or SMTP Couldn't really follow the explanation in the phpvms docs (as I do not know where to find the "Secret" as shown below) No joy. What am I missing please? Expand Mailgun Secret is your mailgun API KEY, if you have a mailgun account you will find it there. And for the SMTP try, your main setting still remains as `mailgun` so it will fail as expected. MAIL_MAILER is the main/driver setting, if you want to try SMTP (either your own server or mailgun smtp) it should be MAIL_MAILER='SMTP' (or 'smtp') as per the docs. And after changing settings at env.php level, you should always clean application cache Otherwise your changes will be not be active. Good luck Quote
William Posted January 18, 2022 Report Posted January 18, 2022 Great answer as always, thanks. So the Secret is the API and that clears the concept. I will modify the ENV.php with the mailgun code posted above as per the docs and see where we go from there. To be continued..... Quote
William Posted January 19, 2022 Report Posted January 19, 2022 I know I am missing something small somewhere because I'm still getting no joy..... Attached the link for the log where I cannot find error about the mail (Mailgun is not receiving anything either) and the ENV.php screenshot of the config. https://www.dropbox.com/s/1unt7p21nqi13rl/laravel-2022-01-18.log?dl=0 Quote
DisposableHero Posted January 19, 2022 Report Posted January 19, 2022 Are you really sure about that “domain” line ? It looks like a full url to me. url/uri : https://domain.com/something/ domain : domain.com Quote
William Posted January 19, 2022 Report Posted January 19, 2022 Nope, I wasn't sure.... Just like I wasn't sure about the "Secret" 😃 I copied it from the API interface within Mailgun, they call it API address so I thought..... Well, you already know what I thought Let me try with just americanva.org....... Quote
DisposableHero Posted January 19, 2022 Report Posted January 19, 2022 As far as I know, mailgun api needs/uses guzzle (which we have already), so up to my understanding from their docs that line should be either `api.mailgun.net/v3/americanva.org` (without https://) or just `americanva.org` (without https:// and mailgun's standard api path). Hope you figure it out and this topic becomes sticky with the answer provided Quote
DisposableHero Posted January 19, 2022 Report Posted January 19, 2022 If API fails (I mean if we fail to set it up), we can switch to mailgun's SMTP and with a working cron (needs testing first) then we can enable queue for emails (which will eliminate the slowness of smtp) and again everything will be working Quote
DisposableHero Posted January 19, 2022 Report Posted January 19, 2022 (edited) On 1/19/2022 at 6:02 PM, William said: Nope, I wasn't sure.... Just like I wasn't sure about the "Secret" 😃 I copied it from the API interface within Mailgun, they call it API address so I thought..... Well, you already know what I thought Let me try with just americanva.org....... Expand Found this from one of my old replies at Discord. So I think, yes only "americanva.org" and your api key (used as secret) will be ok and enough. Hope it helps. Edited January 19, 2022 by DisposableHero Quote
William Posted January 19, 2022 Report Posted January 19, 2022 (edited) OK, thanks! I've tried many combinations, but not that one. I will now and report. Mailgun is setup correctly with the zone records modified on the domain..... So that's checked. I know where to get all the API details and keys on their Dashboard..... Checked too. For sure emails are not going out so it's phpvms unable to get them out because I have not configured it well...... Check. Ironically, I cannot make it even if I use the SMTP settings as provided by MailGun.... But I will keep trying.... Edited January 19, 2022 by William Quote
DisposableHero Posted January 19, 2022 Report Posted January 19, 2022 Well, I really have no idea why it fails @William, some guys tried the api setup it worked well and some other users of phpvms v7 are using mailgun with api too. I am not blaming you, there should be something blocking api access somewhere. Classic smtp settings should work, I mean it is basic mailing, works for every server, why it should fail at yours. You already have server, port, username, password etc for their smtp access. Just use the default SMTP example with that info. SMTP MAIL_MAILER=smtp MAIL_FROM_NAME='American Virtual' MAIL_FROM_ADDRESS='postmaster@americanva.org' MAIL_HOST=smtp.mailgun.org MAIL_PORT=587 MAIL_ENCRYPTION= MAIL_USERNAME='postmaster@americanva.org' MAIL_PASSWORD='that long password here' API MAIL_MAILER=mailgun MAILGUN_DOMAIN='americanva.org' MAILGUN_SECRET='that long api key here' I assume you are cleaning the application cache from admin > maintenance after doing changes to env.php and saving/uploading that file, failing or forgetting this step will cause problems. (technically until you clean the cache your old env.php will remain in effect and changes will not be applied) Quote
William Posted January 19, 2022 Report Posted January 19, 2022 (edited) It's clearly something wrong I am doing - or not doing The cache is a great hint as I was not clearing it after every try, so..... that's a great starting point. I am sure not clearing the cache has made useless many of my attempts. The config you wrote above should work as you say, thanks for writing it down as a confirmation. I will win this battle....😅 Edited January 19, 2022 by William Quote
William Posted January 19, 2022 Report Posted January 19, 2022 Very valuable lesson learned here!! Clearing the cache was the main culprit. For future reference this is the format that works greatly: MAIL_MAILER=mailgun MAILGUN_DOMAIN='your mailgun registered domain' MAILGUN_SECRET='the long api key here' Want to thank you again for all the help and patience 🙏 Quote
DisposableHero Posted January 20, 2022 Report Posted January 20, 2022 (edited) On 1/19/2022 at 9:39 PM, William said: Very valuable lesson learned here!! Clearing the cache was the main culprit. For future reference this is the format that works greatly: MAIL_MAILER=mailgun MAILGUN_DOMAIN='your mailgun registered domain' MAILGUN_SECRET='the long api key here' Want to thank you again for all the help and patience 🙏 Expand My pleasure. At least you learnt the importance of cache by the hard way (maybe the hardest way) around, you will never forget it again Congratulations, enjoy your mails (free for 3 months) with mailgun. By the way, API is the fastest and safest way to implement it, glad it worked as expected and you did not used the smtp solution. Have a nice day Addition; 2022 Jan / Academy award winner screenshot name "An important moment in the history" Edited January 20, 2022 by DisposableHero Added the image for fun and merriment ;) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.