TwigSwiftMailer does not send e-mails - fosuserbundle

I am developing a Symfony 2 site. that site sends e-mails to users using SwiftMailer.
The site uses FOSUserBundle to manage users access and it worked sending e-mails when I, for example request password reset. However, I need to add HTML capability to e-mails, so that I have configured FOSUserBundle to use TwigSwiftmailer instead, so, I changed the config file to the following:
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb'
from_email:
address: info#ivexsolutions.com
sender_name: iVex Solutions
firewall_name: main
service:
mailer: fos_user.mailer.twig_swift
resetting:
token_ttl: 43200 # 12 horas
email:
template: DesytecGestionBundle:Resetting:email.txt.twig
user_class: Desytec\GestionBundle\Entity\Usuario
After I changed that, mails are not being received by recipients. The most frustrating thing, is that the Send method call returns that it has correctly sent the email. Nothing is stored in log... I get no clue about what is happening here.
Can you advice me what to do to solve this problem?
Thanks a lot in advance
Jaime

Never mind... the problem was actually the from e-mail address. It was a forwarding address. I have created a real mailbox to it, and the e-mails were correctly sent.
Regards,
Jaime

Related

Does email sending functionality work in development local builds of react firebase projects?

I've created functionality to send a password reset email from this guide.
My code throws no errors and says that it sends the email to a valid email address but I receive no email.
The only reason I could think of that may cause this is that its running on a react local development build instead of the live build website.
Is it the case that firebase email functionality doesn't work on local builds?
I have checked my spam folder, checked filtering settings on multiple email addresses. It has no reason to be blocked by my inbox settings.
If anyone is looking for the answer to this question, its yes - email sending functionality does work in local builds.
This turned out to be a very complex solution with a long answer, and was not to do with React at all.
Read Frank's answer, and my guide on this post.

Symfony 6 can't send email with mailer (without configured database)

Hello guys i just started to building web using Symfony6 - im trying to send email using mailer however it somehow require database to be configured (+ some special table created for messages...).Maybe there is some workaround so it would work without DB.. - thing is in Symfony 5 there was no problem with that.
If you comment the default configuration in config/packages/messenger.yaml
#Symfony\Component\Mailer\Messenger\SendEmailMessage: async
or set it to null your email should be sent immediately.
By default it's configured to work in async mode via messenger, that's why #glukose 's answer works. It sets sync mode and emails are sent immediately that way.
Your messenger is configured to work via Doctrine, that's why it requires DB. Like this:
MESSENGER_TRANSPORT_DSN=doctrine://default
You can use many other options, like Redis or AMQP, async mode is used for a reason after all.
Anyway async mode won't work without workers started with command php bin/console messenger:consume async. That was my problem because I wasn't aware about what was used. No errors, but emails are not actually sent with Symfony mailer!

How can I access the auth_mellon nameId property in my javascript application

I have implemented mod_auth_mellon in my apache httpd 2.4 webserver. I configured Mellon to authenticate when I try to access my oracle JET application.
So far all is good, when I go to http://example.com, I am redirected to my sso login page and after entering my credentials I am sent back to https://example.com.
My problem is that once I return to my application at https://example.com, I need to be able to access the Mellon-nameid attribute so I can retrieve user privilleges from a database talbe based on email address.
According to all the docs I have read, mod_auth_mellon stores the mellonUser attribute in the apache environment, and/or the response headers.
Also according to what I have read, there is no way in my JET application to access the apache environment variables, and so far I haven't found a way to examine the response headers to get the mellonUser from there either.
Is there an alternate way to access the MellonUser attribute? Can it be stored in teh Mellon cookie, or maybe put on the url as a query parameter?
Also any methods for accessing the headers would be appreciated as well.
Just posting here, even though it's an old thread.
So when you use Apache Mellon, you can supply the nameID in a header value. If you are using apache as a proxy, (I.E you successfully authenticated, now go through the proxy), the web server can access the nameID as an attribute. You can also pass whatever other SAML attributes you want (Assuming you already know how to do this, i'll leave this part out).
Now the problem is, that header value is something the web app (Backend) sees BEHIND the proxy. Javascript is ran client side, in the user's actual browser. So in this scenario it would not be able to see this value unless you tell the backend to send it forward.
As an example, if you setup Apache SAML and then have it proxy to a PHP app, and you have a page that simply dumps the headers:
<?php
foreach (getallheaders() as $name => $value) {
echo "$name: $value\n";
}
?>
OR:
<?php
var_dump($_SERVER);
?>
VIOLA, you can see the nameid and whatever other attributes! However, go to your web console, and poke around, or check out your headers... these will be different because you are getting headers from pre-proxy, while the webapp gets headers from the post-proxy.
So what can you do? In my php example, since PHP will parse first, you can grab the variable from the backend, and echo it into a script that will be ran after this is all done.
<script>
username = "<?php echo $YourHeaderNameID; ?>";
</script>
However, there is some danger to this as well. Client side Javascript and be easily modified. So if your username "johnsmith", and you wanted to change the website username to "joeschmoe", that would be trivial. You should probably have the backend provide whatever user information you require, and then use javascript to style, rearrange, do whatever with.

Email does not send in Laravel API after writing to database

I have an AngularJS 1.5 application which is working with a Laravel 5.2 API and I'm trying to send emails at different points in the application. So I'm able to send data to Laravel and it gets recorded in the tables I specify but when it gets to sending a confirmation email it gives me this error with an HTTP status code of 500: MethodNotAllowedHttpException
Odd thing is, it works perfectly fine in local development on my laptop. But the same functions on the AWS EC2 instance and it fails when it gets to sending any email. I'm using SendGrid to manage sending emails but I don't think I need to change any settings for that.
For Example:
$emailUser = array();
$emailUser['email'] = $request->email;
$emailUser['first_name'] = $request->first_name;
$emailUser['last_name'] = $request->last_name;
$emailUser['randomStr'] = str_random(36);
$emailUser['remove_dtm'] = Carbon::now()->addWeeks(2);
//Add a password reset set to 2 weeks out for the user to register
DB::table('password_resets')->insert([
'email' => $emailUser['email'],
'token' => $emailUser['randomStr'],
'remove_dtm' => $emailUser['remove_dtm']
]);
Mail::send('email.registered_user', $emailUser, function($message) use ($emailUser)
{ $message->to($emailUser['email'], $emailUser['first_name'] . ' ' . $emailUser['last_name']);
$message->from('WSCUSTOMERPO#waterstoneco.com', 'Waterstone Faucets');
$message->replyTo('WSCUSTOMERPO#waterstoneco.com', 'Waterstone Faucets');
$message->subject("Welcome to the Waterstone Faucets Portal!");
});
When I try to reset a user's password it will create the record in the password_reset table but not send the email on the live site. Again the same function works fine on my laptop. I checked that I'm posting on the Angular side and Laravel API is expecting a post HTTP call when running this function.
What am I missing here?
Thank you greatly for your help!
There are a few things to check here,
1: Are you sure you have your .env file set up to use the correct SMTP server settings to use SendGrid. If you forgot to set this up in your .env you will be using the internal mail function. Instead of using SendGrid, I would suggest keeping it inside of Amazon for more reliability. Switching over to Amazon SES may be a great option for you.
2: If you are using the internal mail system, there is a really good article about mail from Amazon EC2 instances here: http://shlomoswidler.com/2009/07/sending-email-from-ec2.html
Just a reminder for number 1 for others that may have come here looking for help. To set your mail service in Laravel to use an smtp service, open your config/mail.php file and set the driver to use your provider (if provided by laravel). This can be done by edit the file directly or setting the environment variable MAIL_DRIVER in your .env file.

DNN 7 - SMTP Test in host settings work, but can't send emails in contact forms

All the sites on this DNN installation stopped sending emails yesterday. When you try and test SMTP in host settings, it sends the test email without any issues.
At first I thought my IP might be blacklisted, but then surely the SMTP test would also fail?
I'm pretty sure the Test SMTP setting in Host directly calls the send mail service in DNN's API. But many other emails are queued up for dispatch for scalability.
Check to see if your "Messaging Dispatch" job in Host > Scheduler has been disabled. If not, check the history by clicking the Log icon on the right-hand side of the schedule tasks list. See if there are errors logged in there.
If all is good there, check your Logs in /Portals/_default/Logs for any issues related to messaging or SMTP.
I would start by checking to see if you have defined a valid (usable) email address on your ADMIN account. DNN will "send" emails from whatever the Administrator is in the site settings, so check the email address on that user's profile, make sure that the email/domain is valid and the SMTP settings you are using are allowed to send from that domain.
If you are developed contact-form dynamic module in your DesktopModules folder then you have to call below DNN SendMail method in your submit button click event.
DotNetNuke.Services.Mail.Mail.SendMail(FromEmailAddress, ToEmailAddress, CCEmailAddress, BCCEmailAddress,
DotNetNuke.Services.Mail.MailPriority.Normal,
EmailSubject,
DotNetNuke.Services.Mail.MailFormat.Html,
System.Text.Encoding.UTF8,
EmailBodyMessage, "", "", "", "", "");

Resources