Magento 1.9.1 Forgot Password issue - php

We are facing a problem with a forgot password on domain.com/customer/account/forgotpassword.
When we enter any wrong email id not associate with any account its works we get this message:
"If there is an account associated with test#test.com you will receive
an email with a link to reset your password."
But when we do with email id associate with account exist its show blank page on domain.com/customer/account/forgotpasswordpost/
I tried solution all side coustmer.xml file mail setting return path yes, but issue is same the same.

You likely have an error breaking your code.
Please check your apache error logs for uncaught errors from Magento
as well as your
root/var/exception.log
and
root/var/system.log
If logs are not enabled, enable them in...
admin/system_config/edit/section/dev/
Debug the following files:
app\code\core\Mage\Customer\controllers\AccountController.php
Use zend debug on: forgotPasswordPostAction line by line on variables such as:
Zend_Debug::dump( $customer );
Zend_Debug::dump( $newResetPasswordLinkToken );
app\code\core\Mage\Customer\Model\Customer.php
changeResetPasswordLinkToken
app\code\core\Mage\Customer\Model\Customer.php
sendPasswordResetConfirmationEmail
app\code\core\Mage\Customer\Model\Customer.php
_sendEmailTemplate
Zend_Debug::dump( $mailer );
Dump out mailer contents on each line to pinpoint which call breaks your code.
As another alternative you can wrap the calls in a try{}catch( Exception $oException ){ Zend_Debug::dump( $oException); }

Related

Can't send mail with Lumen framework and no error appears

Since yesterday I have had problems sending emails with Lumen. I think I have followed all the steps in the documentation correctly, but unfortunately I cannot send anything. Moreover, no error is displayed (I have activated APP_DEBUG=true), and I am sure that the credentials of the smtp server are correct. I also did composer require illuminate/mail.
Here are my modifications in bootstrap/app.php (I have $app->withFacades(); uncommented).
Here is my build function content: return $this->view('emails.mailTemplate', ['message' => $this->message]);.
And the line of code that ask to send mail: Mail::to("wewanthalflifethree#gmail.com")->send(new sendMail($destEmail, $subject, $message));.
Did I do something wrong? :/
Thx in advance for help!
EDIT: I just noticed something, the code stop working when I send the mail. If I add an echo after Mail::send, it will be appear on the page.
I have a problem with the Exceptions handler. By following this answer (which consists in adding a dd in the render function of Handler.php), I am now able to see what's going wrong.
So, here is the reason why my mail didn't send and why my page turned blank: Object of class Illuminate\Mail\Message could not be converted to string (View: /home/serveur-web/api.sl-projects.com/resources/views/emails/mailTemplate.blade.php).
The problem came from the fact that I was using the variable name $message, and this causes problems because it seems to be used in the class that handles the mails. My problem was therefore solved by renaming this variable $mailContent.
I hope this will help other people. :D

imap_open custom error callback

I want to build an authentication system for a website using IMAP. Users should be able to log in with the same credentials as the email account.
Everthing works fine, except if the input data is wrong or didn't match with the email account credentials. If so, there is obviously an error...
imap_open(): Couldn't open stream {domain.com:993/imap/ssl}INBOX
Is there any way to set an custom callback if the imap_open() fails? (Like redirect back with error message, ...)
This is warning level message so you should be able to use error handler, for example:
set_error_handler(function() { /* this will be executed on error */ });
imap_open();
restore_error_handler();
Here is similar question: https://stackoverflow.com/a/1241751/3470670
Here you can find complete documentation about setting custom error handler http://php.net/manual/en/function.set-error-handler.php

CakeEmail is erroneously reporting that a template is missing when using themes

I have a controller QuickContacts with an action add() which uses CakeEmail to send a message, like so:
$Email = new CakeEmail();
$Email->from(array('noreply#xyz' => 'xyz'));
$Email->to(($this->isBranded) ? $this->brandedAccount['BrandedAccount']['contact_us_email'] : EMAIL_TO_MAIL_ADDRESS);
$Email->subject(EMAIL_QUICK_CONTACTS_SUBJECT);
$Email->emailFormat('html')->template('add', 'default');
$Email->message($this->request->data);
$Email->send();
When I try and send the mail, I get an error indicating that a view file does not exist:
Missing View
Error: The view for QuickContactsController::add() was not found.
Confirm you have created the file: Emails/html/add.ctp in one of the following paths:
/var/www/html/mysite/app/View/Themed/Xyz/Emails/html/add.ctp
I can certainly confirm those files exist, but for some reason CakePHP still is unable to find them, and I can't figure out why this might be happening. Can anyone point me in the right direction?
You have to explicitly set the theme in CakeEmail:
$Email->theme('xyz')
as described in the Cookboox 2.x: Sending Templated Emails.
The error message is pointing you towards the correct path, but CakePHP is looking for your file in:
/app/Emails/html/add.ctp
This may be due to a bug.

MODX not sending emails

I'm using modMail class to send custom emails. I have followed the guidelines on MODX site and used the following code which I placed in a snippet:
$message = $modx->getChunk('myEmailTemplate');
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,'me#example.org');
$modx->mail->set(modMail::MAIL_FROM_NAME,'Johnny Tester');
$modx->mail->set(modMail::MAIL_SUBJECT,'Check out my new email template!');
$modx->mail->address('to','user#example.com');
$modx->mail->address('reply-to','me#xexample.org');
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
}
$modx->mail->reset();
The snippet has been modified to contain message from custom chunk as well as email addresses have been replaced with the correct ones. The snippet sent email once and never again. I have no idea what causes such behavior which prevents it from sending emails.
I have read that using the reset function $modx->mail->reset(); resets email fields and allows the email to be sent again yet I have a feeling that it causes problem here.
The snippet is called uncached on the page [[!email]]
Does anyone have an idea why the emails are not being sent, even though it worked once?
if there is an error in your chunk or in processing your chunk, modx is never going to get to thepoint where it logs an error. try something like:
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
}else{
$modx->log(modX::LOG_LEVEL_ERROR,'This mail was sent: '.$message);
}
to see if it logs something. but otherwise what you have there is exactly correct - try to take the $message variable out and send just a string. if it sent mail once, then something else must be wrong. I'd start looking at mail server logs, headers, spam [gmail??] etc.

Fatal error when trying to send an email in Zend Framework 2

I'm getting the following Fatal error when trying to send an email in ZF2:
Fatal error: Class 'Zend\Mail\Protocol\Exception\RuntimeException' not found in /var/www/zend/ZendFramework-minimal-2.0.6/library/Zend/Mail/Protocol/AbstractProtocol.php on line 262
The code triggering this is:
$email = new \Zend\Mail\Message();
$email->setBody('This is a test body.');
$email->setFrom('sender#example.com', 'Sender Name');
$email->addTo('recipient#example.com', 'Recipient Name');
$email->setSubject('Test Subject');
$this->getServiceLocator()->get('Zend\Mail\Transport')->send( $email );
die("I am here");
Where $this->getServiceLocator()->get('Zend\Mail\Transport') returns an instance of Zend\Mail\Transport\Smtp.
However the issue seems to be quite odd because:
The email is actually always sent despite the error.
The error doesn't seem to be trigged until after the script. In the example above, the script is outputting "I am here" and then Fatal error afterwards.
This seems to be linked to where the above code block appears. For example, the error is triggered when the block appears in some Controllers, but not others, despite the only difference between the controllers being their name.
If anyone could give me a clue as to why this is happening I'd be most grateful.

Categories