Does SwiftMailer support asynchronous mail sending the way Mail_Queue does? - swiftmailer

I want to send my emails using sendgrid's SMTP servers, but connecting to them, not at "Web-time", but via a (simple) queue.
I know PEAR's Mail_Queue can enable me to do that, but can I do it using SwiftMailer?
(What are exactly the fonctional differences between SwiftMailer and Mail_Queue?)
Thanks!

SwiftMailer has options for a 'spool'. There are details in the Symfony cookbook. There are also Symfony bundles that extend this system to spool via a database, such as the WhiteOctoberSwiftMailerDBBundle.
From the cookbook:
# app/config/config.yml
swiftmailer:
# ...
spool:
type: file
path: /path/to/spool
Now, when your app sends an email, it will not actually be sent but instead added to the spool. Sending the messages from the spool is done separately. There is a console command to send the messages in the spool:
php app/console swiftmailer:spool:send --env=prod

Related

How to ensure server has sent emails in Jmeter

I'm running a load test in jmeter for a registration scenario. In that scenario, there is a situation where an OTP is sent for the email address provided. Is there a way to ensure that the email has been sent when running the test script. All the email addresses i use are dummy addresses getting from a CSV file. I do not wish to read the email or get any data from it. I simply am required to know if the emails has been sent when a certain http request is hit.
I don't think you can "know if the emails has been sent" without actually receiving it so instead of "dummy" emails you can:
Set up a local mail server, i.e. test-mail-server or real email address(es)
Configure your application to use this test mail server (or real mail server) for sending emails
Configure JMeter to read emails from this test mail server using Mail Reader Sampler. Check out How to Create a JMeter Script to Check Email During Registration AND Grab the Confirmation URL article for more information.

Unable to send email with Attachment in Jmeter: Response code:500 Response message:IOException while sending message

I am facing an issue while attaching a file in my SMTP sampler.
Below are the steps performed:
1-Writing the Summary Report results into a file/folder i.e D:/ABC/XYZ${__time(ddMMyyhhmmss)}.csv (It successfully write on that path)
2-Attaching the same file i.e D:/ABC/XYZ${__time(ddMMyyhhmmss)}.csv in my SMTP sampler against Attach file(s) field.
Now I Execute my Script and got this error.
Response code:500 Response message: IOException while sending message
And after that, when I don't attach any file. My script runs successfully.
One more thing I want to add. Earlier to this script, I was able to send the attachments too but those were from my Gmail account added in SMTP. And now I am doing it from my company's email account i.e. using outlook in SMPT sampler.
Please guide me in resolving the said issue.
Your ${__time(ddMMyyhhmmss)} will generate different results each second:
so you most probably need to amend:
first usage as ${__time(ddMMyyhhmmss,timestamp)}, this way the first function call will store the generated value into timestamp JMeter Variable
second, third, etc. as ${timestamp}
Outlook is an application which can access multiple mailboxes using various protocols like SMTP, POP, IMAP or Microsoft Exchange. JMeter supports first 3, but if your company is using MS Exchange as email transport - you won't be able to use SMTP Sampler, you will have to switch to JSR223 Sampler and write your mail sending code in Groovy using library like javaxt-exchange or EWS Java API

Send SMS from AngularJS Web App using Ozeki sms Gateway

I want to send SMS from AngularJS web application using Ozeki sms gateway. Can anyone tell me how to do this? pr suggest me some reference link or code sample.
Plain sending
Assume we skipping other protocols available inside Ozeki Sms NG product (like SMPP, Email, DB etc), and getting to HTTP protocol only, you can go this way:
Prerequisites:
Figure out best way for you to make HTTP request to send SMS
(I'm not AngJS guy so may be there are already few ways to make HTTP-request from Angular, but at least any Ajax method passing params to executing PHP-script for making HTTP request (with curl, file_get_contents) will be totally Ok).
Make sure your Ozeki SMS server is reacheable via IP/domainname etc by your PHP-script so your code can reach its endpoint.
Doing it:
Inside Ozeki install service provider like HTTP Client
http://www.ozekisms.com/index.php?owpn=195&info=service-provider-connections/http-client-connection
or HTTP Server (more powerful version of HTTP Client allowing call back URLs)
http://www.ozekisms.com/index.php?owpn=197&info=service-provider-connections/http-server-connection
Then according (to docs) execute request like
http://server_ip:9501/api?action=sendmessage&username=________&password=________&originatior=__________________&recipient=__________________&messagetype=SMS:TEXT&messagedata=______________
*Some fields are not necessary, it may vary depending on Ozeki version you use.
** port 9501 - is a default Ozeki HTTP port which may be changed in general settings, also it has HTTPS port as well. Basically the correct port is the same which you already use when accessing Ozeki Web GUI.
After executing sending request (try from browser or from something like Postman first) you should get responce in XML format informing you about result of your transaction.
Possible next step... DLRs
Getting delivery reports (if supported by your operator) is a common "i want it too" question.
In case you need them - there is great embedded feature inside "HTTP Server" connector (mentioned above).
Here you can see more details
http://www.ozekisms.com/index.php?owpn=431
"reporturl" - is a field you may use to set kind of "call back url". In other words in this optional field you may specify full URL and list fields to be passed along. So you only have to create your own endpoint to catch them (as GET request from Ozeki server) and use inside your software.

fwrite() ssl broken pipe in swiftmailer while sending email

I am using Laravel 5.2. I am using Mail queue for sending email. Following is email queue syntax.
$mailArr = array();
$mailArr['subject'] = 'testing mail';
$mail_body = 'testing mail';
$mailArr['description'] = $mail_body;
Mail::to($email)->queue(new CustomMail($mailArr));
If I use "send" instead of "queue" then successfully receiving email.
Queue emails are going in Job table and attempting 3 times and then it is going in failed_jobs table.
In failed_jobs table, I am getting error ErrorException: fwrite(): SSL: Broken pipe in vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:231
I am processing queue with dispatcher and supervisor.
If I manually hit php artisan queue:work even then email is going but automatically with schedule:run written in cron job, is not working.
So any suggestions please what could be the reason?
This response is received when the remote connection closes without informing your server as to why. Usually due to a restriction, such as mail size.
Try using an alternative mailer, such as Mailtrap for example and try the queue again to see if the error response is different.
It is likely you had a plumbing issue; a huge email in your queue prior to your other emails, that’s why sends were processing fine but your queue wasn’t.

Not able to Enable postfix for outbound relay via Gmail on Mavericks

I am trying to enable postfix for outbond relay via gmail
I am following all the steps from this site.
But not able to receive mail.
And got the following msg in file located at /var/mail
host gmail-smtp-in.l.google.com[74.125.129.27] said:
550-5.7.1 [106.78.175.213] The IP you're using to send mail is not
authorized to 550-5.7.1 send email directly to our servers. Please use the
SMTP relay at your 550-5.7.1 service provider instead. Learn more at 550
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336
j5si48631733pbs.31 - gsmtp (in reply to end of DATA command)
Actually I am integrating bot and want to receive mail on success or failure. But not receiving any mail so I googled and found that I have to enable postfix for outbound.
I have also try with mailx <my gmail address> on terminal but didn't receive any email.
I'm going to try to shed some light on some fun I've had in a similar situation. I have the Server 3.0 installed however so where things live can get irritating to track down.
In my situation postfix is running /Library/Server/Mail/Config/postfix. But its moved around from release to release which makes your old configuration start to clutter up your build.
Within your postfix, you should have a main.cf.
I added a section:
>sudo nano main.cf
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks
reject_unauth_destination
smtpd_use_pw_server = yes
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
smtpd_pw_server_security_options = cram-md5,digest-md5,gssapi,login,plain
smtpd_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpasswd
relayhost = [smtp.gmail.com]:587
CTL + O, enter to save
Its important to note now we have to deal with this /etc/postfix/saslpasswd
sudo nano /etc/postfix/saslpasswd
[smtp.gmail.com]:587 first.last#gmail.com:YourPassword*9
CTL+O, enter to save.
There are a couple more commands to issue that I didn't find obvious.
sudo postmap /etc/postfix/saslpasswd
sudo postfix reload
Hope that helps. The Base Mail / Server with the pretty on/off button doesn't seem to do that lat part for you. And I reset my password from time to time. When I do, I have to remember these paths, then make sure I issue those last two commands or the saslpasswd.db gets out of sync.
Good Luck

Resources