I'm trying to use the emailjs (https://github.com/eleith/emailjs) for sending emails in nodejs.
I want to check if email exists before sending it and I do not want to send an email to know this.
So, My question is: How to check if an email address exists on the remote server?
At the network level, receiving and sending email are different operations. In a typical email client (like outlook or a wwebmail program) they appear integrated, but that is an elaborate illusion.
Your question mentioned a npm module to use SMTP to send emails. That's the way email clients do it.
Email clients use the POP3 protocol and sometimes the IMAP protocol to read messages from mailboxes on email servers. Some npm modules handling pop3 are available for node.js, and you can use one. But you will have to create the code to "know this email exists" as you put it in your question. You will read emails from the mailbox -- all of them! -- and examine them for the information you need to "know this email exists." If the inbox you read also belongs to a person, you need to be careful to tell POP3 to leave the messages on the server.
Related
I have a basic SpringBoot 2.0.5.RELEASE app. Using Spring Initializer, JPA, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file.
I've configured the springboot properties as follows:
spring.mail.host=smtp.gmail.com
spring.mail.username=nunet#gmail.com
spring.mail.password=nunet999!
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.socketFactory.port = 465
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.socketFactory.fallback = false
spring.mail.propertirs.mail.smtp.ssl.enable = true
and It is working fine when sending emails. I also have an email address from my domain info#nunet.com
I am using Postfix to forward the Emails from info#nunet.com to to nunet#gmail.com and its working fine.
I would like to know if there is a way to do it on the other way around. Send emails from info#nunet.com but using nunet#gmail.com smtp to avoid to install a Mail server.
or basically I would like to know how to extract the smtp properties from my linux server, because from there I can send emails using the command
cat ~/test_message | mail -s 'Test email subject line' nunet#gmail.com
I think you need Google Suite's email feature. With this feature You can create a custom email address using your own domain name then send & receive emails with Gmail (Gmail Suite).
After configuration working with Gmail's SMTP is same as you done before.
Read more: https://digital.com/blog/create-email-using-gmail/#ixzz5Sxusynvb
Basically this is possible with SMTP, but the most SMTP-Hoster don't allow it to avoid spammers to send spam. Furthermore the most E-Mail-Hoster will detected that kind of mails as spam.
I need to build an email backend that can receive email, send email, store them in the db, like other all email services, such as Gmail or Yahoo.
Which module should I use to build such app? I searched about this, but it's all about nodemailer, which is just a sending module.
Depends on what you actually want with the backend.
For parsing mail messages i should use a package like mailparser. It tries to parse the source in different objects. Like to, cc, bcc, attachments, body etc.
For loading the messages, you can use one of the several IMAP clients. Store them with the mysql package.
Sending ofcourse with nodemailer.
The big question stays, what is the purpose of the backend. Creating a mail backend is not a easy task. Loading from IMAP and sending by SMTP is not the problem. But if you want create a service like Gmail or Yahoo, you need think about a lot aspects, like SPAM protection, queueing of mail, throttling of the outgoing mail and a lot more.
I am new to node.js where in my requirement is to grab received email subject, attachment and email body using node.js I am not able to find any solutions. Can anyone suggest me what kind of approach I should take.
I've read that nodemailer only permits to send mail (if I m not wrong).
You should use a librarie that allow you to receive message, like using POP3 protcole (https://www.npmjs.com/search?q=pop3)
I am using the nodemailer SMTP node module, a simple way to send emails through SMTP.
I am using this to send out text messages to various cell carriers, which will allow you to send a text message for free via email. An example email, which will text the Sprint phone (310) 987-6543:
3109876543#messaging.sprintpcs.com
These are all going out through one SMTP email address. This means all text replies from someone's phone will channel back to my email address.
A lot of people send these texts. I want to route the reply text back to the right person, using my own server side code.
The problem is distinguishing where the text came from. Ideally I could hide my own primary key ID for the sender in some sort of SMTP header, which would arrive at the recipients phone and come straight back in their text reply.
I don't really know anything about SMTP or email protocols - is this possible?
edit
As given in each of the answers below, in better email servers you can address to an email address as well as an extension to that address, such as:
// original email
sms-service#mysite.com
// extension
sms-service+a6e1087b#mysite.com
This would be a correct answer and would solve my problem, if only this worked in Exchange Server, which is the email server I am using. I don't know if there is a way to enable this or any other workaround.
Exchange server doesn't support plus addressing natively but it is possible do achieve this with a custom MTA, e.g. http://durdle.com/regexcatchall/
Source: https://serverfault.com/questions/195276/does-exchange-support-plussed-users-e-g-mynamespamexample-com-or-a-similar
Here are a few approaches that you might be able to use:
Unique from addresses
You could you use unique "from" or "reply-to" address for each each message (or for each recipient). For example "sms-service+a6e1087b#mysite.com". In that example, the hex would be a unique identifier that can be mapped to the conversation in your database.
Gmail supports such a scheme: emails targeted to [foo]+[whatever]#gmail.com will be delivered to [foo]#gmail.com and the receiver will know also get the [whatever] back. (more on this http://lifehacker.com/144397/instant-disposable-gmail-addresses)
Identify the user, not the conversation
One option is to not identify the conversation, but identify the phone number the reply comes back from instead. In many cases, the number from where the SMS reply was sent back from is enough to connect that message to the conversation. I'm sure the SMS gateway you're using will provide you with the number from where the reply came from.
Commercial SMS gateway
You can also opt to use a commercial SMS gateway (smsglobal.com comes to mind, though there are many others). These services have well defined APIs for sending a receiving replies. This naturally comes at a price, though. But along with the price, you do get more confidence as to the reliability of the service. A free SMS gateway might get shut down without much warning.
This common problem is traditionally implemented using the semantics of From: and Reply-To: headers of e-mails. This is in fact not (directly) related to SMTP, but rather to ARPA network text messages.
RFC 5322 is the current specification of these messages. It states:
When the "Reply-To:" field is present, it indicates the address(es) to which the author of the message suggests that replies be sent. In the absence of the "Reply-To:" field, replies SHOULD by default be sent to the mailbox(es) specified in the "From:" field unless otherwise specified by the person composing the reply.
So you simply need to encode the information you need into the Reply-To: header. Since you mention your own server-side code, you might be running an SMTP server yourself. In this case, you can put any address that will be routed to your SMTP server and encode the right person's address there.
Alternatively, if you rely on another SMTP server, you might want to use aliases. Postfix, and mail services such as GMail, typically allow address extensions, i.e. addresses of the form user+foo#domain.com, and you can encode the necessary information in the address extension.
For example, let's say that alice#domain.com wants to send a text to Sprint phone (310) 987-6543 through your service, you could send an e-mail to 3109876543#messaging.sprintpcs.com with:
Reply-To: alice%40domain.com#yourservice.com
Alternatively:
Reply-To: yourservice+alice%40domain.com#gmail.com
This will allow you to route the reply properly by looking at the destination of the reply e-mail.
In my application im using mailgun module to send and receive emails using node.js.I don't know how to receive the incoming emails.I created route to receive the incoming email.but its not working.
Mailgun is simply posting URL encoded form data.
Check out this discussion on receiving POST data in node.js: How do you extract POST data in Node.js?
Also it's worth noting that for whatever mail-header-related reasons, if you have mailgun set to forward something to a#b.com, then messages sent from a#b.com will not show up back in your inbox. Send mail from a different address. Note that mailgun can sometimes tell if you're using the Send As feature in gmail, and will know your main address.