While send form, phpMailer problems - phpmailer

I want to send some information on form in goverment website. But when submit, this error:
" SMTP Connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting "
What is this problem?

Related

How do I send Request in Robot Framework It Gives 500 server error

//How do I send Request in Robot Framework It Gives 500 server error
//This is the request body that I want to send
{
"destinationFaxNumber": "9546599326",
"documentCount": 1
}
*** Variables ***
${base_Url}= https://07du47r041.execute-api.us.com/dev/v1/outbound
*** Test Cases ***
Send Fax Request
${headers}= create dictionary Authorization=${Token} Content-Type=application/json
#${file_data}= Get Binary File D:TestCases/SendFax.json //commented
${body}= create dictionary destinationFaxNumber=9546599326 documentCount=1
create session faxsession ${base_Url} headers=${headers}
log to console ${body}
${response}= Post On Session faxsession /fax data=${body} headers=${headers}
However I'm getting below error
HTTP Error: 500 Server Error: Internal Server Error for url: https://07du47r041.execute-api.us.com/dev/v1/outbound/fax
If postman works and RF does not, the request payload is 99.99% at fault. Capture network traffic with succesful and failing requests and compare what is different.
For example, if you have access to linux box or any machine with netcat, start nc on some port and point the url from postman and rf into that NC socket and see the request differences right in the console of nc.

Authentication errors when sending intermittent emails from gmail using Heroku / node.js / emailjs

I am running a scraper app on Heroku that sends emails every once in a while. Sometimes it'll be every 2 minutes, sometimes it won't send anything for 2 days-depends on what the scraper finds. I am running into continual errors with email authentication. I have tried configuring the email with nodemailer and emailjs. Both run into the same issue. I am wondering if it is because of the way Heroku servers are distributed?
I have taken the following steps:
1) unlocked the account at: https://accounts.google.com/DisplayUnlockCaptcha
2) allowed less secure apps here: https://myaccount.google.com/lesssecureapps
With both nodemailer and emailjs, I notice that it works fine for a couple hours but then if no emails are sent for a day, as soon as it tries to send another one I receive an authentication error. Here is the code using emailjs that works for a couple hours then fails with an authentication error:
var server = email.server.connect({
user: process.env.CRAWLER_MAIL,
password:process.env.CRAWLER_PWD,
host: "smtp.gmail.com",
ssl: true
});
var message = {
text: "Placeholder",
from: 'NAME <'+ process.env.CRAWLER_MAIL+'>',
to: eachEmail[0],
subject: emailSubject,
attachment:
[
{data:emailBody, alternative:true}
]
};
server.send(message, function(err, message) { console.log(err || message); });
And here is the error from the Heroku log:
Error: authorization.failed (bad response on command '[redacted]': -5.7.14 https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=[redacted]-)
I don't use 2-step verification for this account, so I don't think I need an app password. Any other ideas about how I can get this to consistently work?

twilio receive sms without responding back

Good Day,
How do I properly receive an SMS on my web app using twilio without responding back to the sender.
I read about this.. https://support.twilio.com/hc/en-us/articles/223134127-Receive-SMS-messages-without-Responding but I need to use the webhook to send the sms to my webapplication too, if I do receive it without setting a response, It will generate an Error - 11200 (HTTP retrieval failure) how do I prevent this? also by setting up respones.
my code is
var resp = new twilio.twiml.MessagingResponse();
resp.message('<Response></Response>');
res.writeHead(200, {
'Content-Type':'text/xml'
});
res.end(resp.toString());
sadly this one sends <Response></Response> to the sender instead.. im using nodejs by the way.. Thanks!
Those who are finding this in 2021,
If you need to just recieve message from twilio and not send any message to user then you can use this code.
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end();
For more refer this doc,
Receive SMS and MMS Messages without Responding
I have not tried yet but I think if you comment out this line:
// resp.message("<Response></Response>");
no message will be sent.
Update after reading Phil's comment:
This: resp.message('<Response></Response>');
is equivalent with sending the folowing XML to Twilio:
<Response>
<Response></Response>
</Response>
in which case the sender will receive a message like: <Response></Response>
If you comment out the line
// resp.message("<Response></Response>");
or if you do resp.message("");
is equivalent with sending the folowing XML to Twilio:
<Response />
in which case no message will be sent to the sender.

Mail messages sent from nodemailer are not showing in user mail sent box

I am sending messages from my domain account but they are not showing in user(from options of nodemailer) sent box.But when sending messages from gmail service messages are showing in sent box of user.Am I missing something in below code?
var transport = nodemailer.createTransport({
host: "xxxx.domain.com",
auth: {
user: 'xyx',
pass: '123'
}
});
transport.sendMail(options, function (err, info) {
if (err) {
console.log(err)
}
console.log(info);
});
When you send a mail using a regular mail client, such as Thunderbird, it will send the mail to your SMTP server, which then relays the message to the receiving mail server (also via SMTP). The copy in your sent folder, however, is additionally saved on your mail server via IMAP. So your mail is actually send twice, once to the receivers mail server, and a copy is "send" to your own mail server.
When using nodemailer you only provide the credentials for your SMTP server, so the mail is only send without storing a copy in your sent directory. So this is basically working as intended.
I can think of two ways to save a copy of the mail in the sent directory:
Use an additional library, such as node-imap to imitate the behavior of a regular mail client and manually save a copy of the mail (e.g., node-imap has an append method to save new mails).
Add your own mail address as BCC to all outgoing mails and use some type of server side filtering to automatically move them to the sent folder. This is computationally less expensive for your application, but has the additional filtering requirement for the mail server.

Bulk email sending usiing node.js

I am trying to make a small dashboard where i can send bulk email using my own SMTP servers. I want to use node for this, can anyone guide from where to start i want to send mails from different SMTP servers.
A most common way to send email in Node is using Nodemailer. It has an excellent documentation.
You can use it to send email using any SMTP servers and there are a lot of preconfigured ways to send using Gmail or other specialized transports.
The available transports are - from the README:
nodemailer-mailgun-transport for sending messages through Mailgun's Web API
nodemailer-mandrill-transport for sending messages through Mandrill's Web API
nodemailer-pickup-transport for storing messages to pickup folders
nodemailer-sailthru-transport for sending messages through Sailthru's Web API
nodemailer-sendgrid-transport for sending messages through SendGrid's Web API
nodemailer-sendmail-transport for piping messages to the sendmail command
nodemailer-ses-transport for sending messages to AWS SES
nodemailer-sparkpost-transport for sending messages through SparkPost's Web API
nodemailer-stub-transport is just for returning messages, most probably for testing purposes
nodemailer-wellknown for sending messages through one of those many supported services
nodemailer-postmark-transport for sending messages through Postmark's Web API
add yours (see transport api documentation here)
Here is a simple usage example in the Nodemailer GitHub repo
var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
var transporter = nodemailer.createTransport('smtps://user%40gmail.com:pass#smtp.gmail.com');
// setup e-mail data with unicode symbols
var mailOptions = {
from: '"Fred Foo 👥" <foo#blurdybloop.com>', // sender address
to: 'bar#blurdybloop.com, baz#blurdybloop.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world 🐴', // plaintext body
html: '<b>Hello world 🐴</b>' // html body
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log(error);
}
console.log('Message sent: ' + info.response);
});
See:
https://nodemailer.com/
https://github.com/nodemailer/nodemailer
For bulk mailing it's much better to use a service like Mailgun or Mandrill because doing bulk mailing yourself using SMTP it's a lot of hassle to make sure that your emails are going through spam filters and that you are not blacklisted for sending too much email, that you don't exceed any limits of your ISP etc. Sending emails is more complicated than people usually think and with prices like $0.0001 per email in Mailgun it's also dirt cheap.

Resources