I work with Symfony2, up to date (2.4.1). I send an email with Swifmailer, but it never delivered.
Symfony's logs say the email is sent. I tried with memory and file spooling. With the file spooling when I execute swiftmailer:spool:send --env=dev, it says "Processing default mailer... 1 emails sent". So everything is supposed to work. The config is ok (no delivery_address defined for dev or other way to catch mail while developing).
My SysAdmin says there is no problem on the serverside. The others SF2 host on the same server (other Virtual host) are sending mail fine. So I tried to place my app on a supposed working other virtual host, but no way, emails don't arrived. I begin to think it's an issue with the last version of Symfony (my others app are on 2.4.0). I tried to create a new symfony app, from zero, and I get the same problem. I'm lost. Does somebody have a similar problem? Or a way to fix it?
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('noreply#domain.com')
->setTo('myemail#example.com')
->setBody('TEST');
$this->get('mailer')->send($message);
PS: When I send an email with mail() function of PHP, it works.
Related
I am trying to send mail using PHP Mailer but there is an issue with setfrom() method
In $mail->setFrom('abcd#abcd.com', 'Jay');
When I use domain name .com mail gets sent and received properly
But when I use . co domain name example $mail->setFrom('abcd#abcd.co', 'Jay');
Its doesn't show any error and says mail sent successfully but mail isn't received on my account.Tried changing google privacy settings.
Note:Not using SMPT kept it to false using default settings
Update:Ok so the thing is It is working but the emails are being receive after hours and hours if I use .co but when I use .com email are received immediately.
Probably server problem.
This sounds like a known problem that's been answered before: gmail does not allow setting arbitrary from addresses. You can preconfigure aliases in settings, but you can't simply start using them at the sending client. You can see the submission conversation by setting $mail->SMTPDebug = 2;, but if it's sending successfully, PHPMailer has no involvement beyond that point.
Ok so the problem was the server (bluehost)
What was happening is whenever the setFrom() had an email address whose sub domain was not '.com' eg: " abcd#abcd.co,abcd#abcd.in" the mail was being received after several hours.
It would work normally if setfrom() was set to a normal address eg: a#gmail.com .
Probably a server issue.
I am currently in the process of doing a project in magento.
I have a problem with my contact form: emails are not sent to me.
I did a test and I still get this message:
Unable to submit your request . Please, try again later
It's probably because an exception is thrown as you can see in the file
app/code/core/Mage/Contacts/controllers/IndexController.php in the postAction() function, you should try to debug from here.
Maybe the contact email failled to be sent (if you are in localhost and have no mail server?), that could cause the exception that shows this error.
I've been struggling with this for a day as nobody gives a clear answer on the topic.
In order to get it working there are 2 options:
Configure smtp server for email sending using smtp pro extension from Magento connect
Make Magento use the SendMail function of the webserver
As the first option didn't work for me, as my hosting provider somehow block the smtp outgoing connection, I needed to use the SendMail function.
The quick and dirty trick I used, was to change /app/code/core/Mage/Core/Model/Email/Template.php line 116:
Zend_Mail::setDefaultTransport($transport); → //Zend_Mail::setDefaultTransport($transport);
After this my error message at the contact form was gone and I received
the email correctly.
Be carefull: This is not a good solution as it will be undone at a Magento update. Also it was not tested for the other email functions of Magento.
I am using the FOSUser bundle within my Symfony2 application. I am trying to get the email functionality working but can't get any emails to send successfully.
My development environment is a Ubuntu virtual machine. I tried to use my Gmail account details as described here. I also checked the error logs but nothing regarding the email sending is logged.
I attempted to send a test email using a test controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class TestEmailController extends Controller
{
public function sendEmailAction()
{
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('send#example.com')
->setTo('me#myemailaddress.com') // use a valid email in actual code...
->setBody('yo, wassup!');
$this->get('mailer')->send($message);
return $this->render('SysDevPunctualityBundle:TestEmail:sendEmail.html.twig', array(
// ...
));
}
}
However this triggers an error with Symfony's web profiler toolbar and I get the following message; "Token "3c494e" was not found in the database."
After some digging around I found this question I followed the suggestion of removing the spool option and also added a 'from_email' option. This made a difference, I am now getting a timeout error:
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
My guess is that the firewall is blocking the request, I don't know how to find out for sure.
Appreciate if anyone can point me in the right direction.
I discovered that the source of the problem was that my work firewall was blocking access to the Gmail SMTP server. I switched to another SMTP server (set up by our IT department) and email sending now works fine.
Check these two links from the cookbook, to find out how to handle emails while developing: http://symfony.com/doc/current/cookbook/email/dev_environment.html & http://symfony.com/doc/current/cookbook/email/spool.html
we had an issue with our sendmail program recently. for some reason it wasn't working. i ended up fixing it, but we're still not receiving confirmation emails from the store. it doesn't give us an error (as far as i can tell), but it simply isn't sending. is there anywhere somebody could suggest i look to fix it? log files, PHP files, anything? i'm at a loss and i've been working on this for 2 days with no results. the client is getting more and more impatient.
the email user is receiving all other emails, the sendmail program is working properly, etc. I have no clue what could be wrong. can somebody at least point me in the right direction?
You can do the fallow steps to trouble shoot the problem
run this command in the server:
echo "This is a test." | mail -s Testing someone#somedomain.com
check is the email daemon is working
check the email log server at /var/logs/sendmail this depend of your enail server software
try this configuration
Go to System > Configuration > ADVANCED > System > Mail Sending Settings
Disable Email Communications = No
Host = I changed it from localhost to mail.mydomain.com
Port (25) = 25
Set Return-Path = No
Good Luck
I am trying to send out password reset links for when users forget their password to login to a system I am creating. The problem is, the smtp server is supposedly not configured on the server my system is hosted on. So whenever I try to use the php mail() function to send an email to an internal email address, the emails fail to send, but outside email address (tested with a gmail account), the emails go through. I believe this is because my server is sending directly out to the internet instead of passing through an internal smtp server to resolve where our domain emails should be sent. I was wondering if anyone knew how to configure this on an Xserve or if they knew how to specifically tell the php mail() function where to initially send the email. Any help or pointing in the right direction would be extremely helpful.
Thank you!
mail() doesn't send mail, it just hands things over to the local SMTP server. It does NOT reach out to the recipient's server to deliver the mail. In real world terms, mail() walks your letter down the street and drops it into the neighborhood mailbox. After that, it has absolutely nothing more to do with mail delivery.
Check your local SMTP server's logs to see why the local mails aren't being delivered. There should be a line or two saying why it's registered. Perhaps the local MTA (mail-transfer agent, aka the local "mail man") isn't configured properly.
You can control mail() with it's settings.
This might not solve your overall problem, but hopefully it's useful. This related answer has more information.
We just addressed this problem internally here. Hopefully this will help you as well.
Our environment:
Ubuntu 12.04 LTS
PHP 5.3.10
We could telnet into our SMTP server and send mail from our web server, so it wasn't a permissions issue. When attempting to mail externally, all works perfectly. When attempting to mail internally, silent failure.
Our PHP is using sendmail, which by default, attempts to relay mail to 127.0.0.1. Point this at your SMTP server by editing /etc/mail/sendmail.cf. Update the line from:
# "Smart" relay host (may be null)
DS
to
# "Smart" relay host (may be null)
DSyour.smtp.server.com
Restart sendmail and try sending yourself an email via PHP.
This is something that occurs on Parellels’ PLESK server administration software.
Find your ‘main.cf’ configuration file for PostFix, which for CentOS 6, is located at
/etc/postfix/main.cf
If you can’t find it, do a
which postfix
SSH command to at least see where Postfix is on your server.
Then, open the file up through a text editor, or in the Linux shell, and make these lines (should be at the end of the file, around line 677) :
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox
commented out like this :
#virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
#virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
#virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox
Then, restart the Postfix service
sudo service postfix restart
Apache while your at it (can’t hurt), and voila! Your email address should be receiving those emails now. This also doesn’t affect any of your regular emails or anything else, either.