Magento 2 is sending Emails in english if sent programmatically - php

I'm looking for hours now and I found some topics that are similar but none of them solved my issue.
I'm writing a Magento 2.3 Extension to import customers from a different Database. Everything works fine except for the email language.
I would expect Magento to use automatically the correct language (store config) when i'm sending the "New Account Email"
Here is the method I'm using to send the Email
$customer->sendNewAccountEmail();
If I send the "Password Reset" Email by clicking on the corresponding Button in the customer settings, Magento sends the Email in the correct language.
I tried different config settings and different ways of set the locale inside my import method. Obviously nothing worked.

For me the following worked:
$customer->sendNewAccountEmail('registered', '', $storeID);

Related

The same newsletter mail randomly sent to the registered customers

My website built in bespoke n-retail coding based on PHP. Currently, I am having an issue whereby the same newsletter message randomly sent to my registered customers.
Where in the file manager I need to check to find the issue. It must be a bug somewhere.
There are 2 possibility
1. Newsletter is send from admin side
2. Cron job
You need to check both files so u get then bug, also provide more information so we can help you.

Finding the files related to confirmation email in checkout, opencart

I'm using opencart version 2.1.0.1
I want to find the files related to confirmation email in opencart.
I don't know if the core files were changed but the confirmation email for orders, suddenly stopped working. Both the store owner and the customer don't receive them.
Can anyone give me the names of the files related to confirmation email, so that I can replace them with the original ones ?
You can find the file at below location:
your_project\catalog\model\checkout\order.php
The email code is at the last of the confirm function.

Opencart self developed module not sending emails to admin and store owner

A friend of mine and me developed an opencart payment module for a bank payment, meaning when you click confirm order, it takes you to the bank API. Everything works fine except for the fact that the following does not occur:
Payment does not effect on the dashboard
An emails is not received by the administrator even though we have used finfo#example.com and Finfo#example.com, I have included series of emails in the email field at the bottom of the page in the setting->mail tab->alert emails
All orders are being tagged as "Missing"
I tried cash on delivery and it worked fine (it sent emails)
I am on opencart 1.5.6 (boss theme goMarket)
Do you think setting an SMTP will do the magic? if yes, how can I get and set the SMTP from a GoDaddy hosted email acccount. I'd appreciate if you can help me with the solutions and where the errors may be coming from.
My guess is that you have a problem with the checkout/order controller.
Go to catalog/model/checkout/order.php and look into the confirm() function.
Something is probably making it fail because this is the function that handles both the database change from 'new' order to 'pending' as well as sending the email.
Under the confirm() function, look for $mail->send and simply comment out everything that has to do with sending the email. Then try to run a transaction. My hunch is that your problem is in the email sending syntax.
If that still doesn't work, you've got a bigger problem.
Try to debug this function row by row while using var_dump() on the variables and seeing the results. After few times you'll be able to see when exactly the function breaks and take it from there...
Regarding your question about smtp - it could be your settings, but from my experience if your settings are not correct, it will not break your code execution. What you are experiencing sounds like a php syntax error to me.
One more thing - sometimes smtp will fail when using a local environment like mamp or wamp so make sure that (a) your mail settings are correct (b) that you deployed the site, even if it's a temporary address.
And one last thing - go to Admin->Settings->Error Logs and look for clues.
Hope this help!

Why Isn't Google Apps Email Address Receiving Email From Magento Website?

Ok, I've been working with this Magento 1.7.0.2 website:
http://www.kharmakhare.com
There are two forms currently on the website. If I change either form to any kharmakhare.com email address, the email is never received. If I change either form to my email address, I get the email just fine.
Yes, I HAVE checked spam. The Kharma Khare email address will not receive emails from Magento. I thought it had to do with the Google Apps not being installed correctly... except when I logged into the email there were already tons of emails in there.
They don't have any problem receiving emails, they just don't receive any emails from the website. I've searched online for an answer. All I can find is problems sending emails through Google Apps, not receiving them.
My client already did set up the SPF records as well. In addition, last time I was in Google Apps (at least a year ago) it looked completely different, so I don't know where anything is anymore.
The first form is on the contact page (this uses Magento's default contact module):
http://www.kharmakhare.com/contact-us
The other is opened by clicking on the "Free Sample" tab on the upper right side of the screen. After spending hours working on this over a couple days I finally figured out how to do what would've been a 10-minute job in wordpress; creating an alternate email form. -_-
Regardless, although I know both forms work, neither one will send to the email address it actually needs to get sent to, and its driving me nuts. Does anyone have any idea what might be causing this problem?
Switch off the mailserver for that domain.
The reason they are not getting the emails and you are is that the sending address is something#kharmakhare.com and the receiving address is somethingelse#kharmakhare.com. The MX records offloading the email to Google Apps are not used in this instance as the server will look for the local mailserver first.

how to receive and validate incoming mail for web based mails in php

We are developing a email web site.but we are facing problem in receiving and validating the mail.i have the following doubts.can you please help me in clarifying these???
one more important thing is we are not using squrrelmail, qmail etc.
how do we receive emails for users in email web site?
do we save all the received emails in admin's mail box or in database as per the username
(my idea on email web site is,all the incoming mail are stored in admin's mail box and after the email mail is stored in database,and then the mail deleted in admin's mail box.Is it correct.if not how to store the emails in database directly in web site)
what is the technique behind the receiving mail???i think there are various techniques like email piping etc.
is there any special process of creating users for email web site,i mean do we need to create mailbox(i think mail account) for each user at the time of registration.if we need to create mail box for user,can we create it with imap_createmailbox() function.
are the users gmail,yahoomail etc are accessig database or their mail accounts at the time their login??
can we do all these things with imap functions in php??
There are many different solutions to this problem, polling existing servers, adding scripts to run when a message is received or using a gateway like CloudMailin. I wrote a blog post relating to this (it's for rails but almost all applies to php too).
The other problems almost all span from how you setup the first thing. In many cases you could just log the emails directly to your database and retrive them based on the recipient address. I think you need to explain exactly what you want to do with the email? Are you just providing email hosting for your users or are you providing an additional service? If you're just providing hosting then there are simpler approaches available.

Categories