<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ivan Djuric</title>
    <description>The latest articles on DEV Community by Ivan Djuric (@idjuric660).</description>
    <link>https://dev.to/idjuric660</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1461858%2Fff69328e-2725-4281-8eec-fb32dbd8c5b7.png</url>
      <title>DEV Community: Ivan Djuric</title>
      <link>https://dev.to/idjuric660</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/idjuric660"/>
    <language>en</language>
    <item>
      <title>Best Email Encryption Software</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Mon, 16 Dec 2024 09:49:49 +0000</pubDate>
      <link>https://dev.to/idjuric660/best-email-encryption-software-2ppb</link>
      <guid>https://dev.to/idjuric660/best-email-encryption-software-2ppb</guid>
      <description>&lt;p&gt;There’s a lot of talk going on about data encryption. Nearly every day we hear about email leaks and we start to wonder if our data is secure. And rightly so! Those who ignore such vital concerns are often the hacker’s first victims. However, those who do give it some more thought use some of the best email encryption software on the market and keep their data secure. What should you pick? Let’s go through the best available options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is there a need for more email encryption?
&lt;/h2&gt;

&lt;p&gt;A huge majority of emails sent over the internet are transferred via the SMTP protocol. Old technology serves the purpose well but offers little to no security. This means that your emails are often transmitted between servers in plain text mode. If there’s a breach at any stage, all the information will be easily accessible to hackers. &lt;/p&gt;

&lt;p&gt;Of course, ever since the 80s, efforts have been made to address this problem. New methods, such as SSL and TLS, have been introduced for encrypting your emails. These days, all major clients provide some form of encryption. Things have definitely improved.&lt;/p&gt;

&lt;p&gt;But your emails are still far from safe. SSL/TLS only encrypts emails on their way from a client to an outgoing server. At this point, they’re decrypted and processed further in plain text, making them susceptible to attack. SSL/TLS also doesn’t encrypt emails sitting in your inbox or your receiver’s. If security is breached, all sensitive data will easily be exposed.&lt;/p&gt;

&lt;p&gt;Another caveat is that the SSL/TLS used by nearly all clients is, by default, opportunistic. This means that when a transmission is launched, an email client uses a command called &lt;a href="https://mailtrap.io/blog/starttls-ssl-tls/" rel="noopener noreferrer"&gt;STARTTLS&lt;/a&gt; to try to upgrade the connection to a secured one. However, if it fails due to a timeout, lack of server support for this solution, or just about any error, the transmission will be processed in plain text. It may be fine for casual messaging, but for companies or governments sending heavily classified data over emails, it’s too much.&lt;/p&gt;

&lt;p&gt;If you’re interested to read more about this, check out our article on &lt;a href="https://mailtrap.io/blog/smtp-security/" rel="noopener noreferrer"&gt;SMTP Security&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is email encryption software?
&lt;/h2&gt;

&lt;p&gt;To counter the imperfections of existing encryption methods companies have built lots of sophisticated tools for email and data encryption. They incorporate many different techniques for securing emails, which can be split into two main categories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enterprise email encryption platforms&lt;/strong&gt; are typically used for internal communication in large corporations or between governmental facilities. These platforms only work if both a sender and recipient use the same encryption software. If you were to encrypt an email this way and send it to an external receiver, they would have no way of deciphering it.&lt;/p&gt;

&lt;p&gt;These solutions typically rely on public and private keys that they distribute in a network. A message is encrypted with a user’s public key and each of the recipients is able to decrypt an email using the corresponding private keys. Of course, the whole operation happens under the hood and is invisible to actual users.&lt;/p&gt;

&lt;p&gt;The advantage for companies is that they can manage their own keys without sharing them with 3rd parties (such as encryption platforms themselves). The disadvantage is that if something goes wrong and the keys are no longer able to be retrieved, the messages encrypted with them won’t be either.&lt;/p&gt;

&lt;p&gt;Although some of these solutions can be installed, most work as hosted email encryption platforms. Due to their universality and platform-agnosticism, we recommend using them moving forward.&lt;/p&gt;

&lt;p&gt;On the other end of the spectrum, there are &lt;strong&gt;webmail services for email encryption&lt;/strong&gt;. While the enterprise solutions are often difficult to set up and maintain, webmails are (generally) as easy to use as regular Gmail or Yahoo! accounts.&lt;/p&gt;

&lt;p&gt;Webmail also relies on public and private keys. Some tools store them for you and automatically exchange them with your recipients. This makes for a pretty seamless experience.&lt;/p&gt;

&lt;p&gt;Other web-based tools hand you the task of managing keys. This way, no governments are able to decrypt your data but you’re in charge of storing the keys and sharing them with the recipient(s).&lt;/p&gt;

&lt;h2&gt;
  
  
  Best hosted email encryption services
&lt;/h2&gt;

&lt;p&gt;Let’s now discuss our top picks for email encryption software in 2020. There are plenty to choose from! &lt;/p&gt;

&lt;h3&gt;
  
  
  ProtonMail
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmwyjp9ehgvni2qg5dt3l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmwyjp9ehgvni2qg5dt3l.png" alt="Image description" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://protonmail.com/" rel="noopener noreferrer"&gt;ProtonMail&lt;/a&gt; is a popular free email encryption software. It’s actually an email client that works like any other software of this type. There’s just one “tiny” difference: all emails sent from ProtonMail account are end-to-end encrypted. The same goes for emails accepted from other senders. They remain encrypted while in an inbox.&lt;/p&gt;

&lt;p&gt;ProtonMail was launched by a group of scientists and developers concerned about user privacy. They aim to provide a platform where users can freely exchange information and are protected by strict Swiss privacy laws. They have managed to attract millions of users craving for a secure way to send emails.&lt;/p&gt;

&lt;p&gt;The account is free with 500MB of storage and allows you to send up to 150 emails per day. Paid plans come with a higher capacity and more features (and they’re quite inexpensive too). Web and mobile apps are available.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tutanota
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxculgxu8lgbwic5nkuro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxculgxu8lgbwic5nkuro.png" alt="Image description" width="800" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right across the northern border from the Proton guys, there’s &lt;a href="https://tutanota.com/" rel="noopener noreferrer"&gt;Tutanota&lt;/a&gt; hailing from Germany.&lt;/p&gt;

&lt;p&gt;Tutanota is also a web service with end-to-end encryption for all its emails. The platform encrypts all elements of a message, including a subject, body and attachments. It also removes your IP address from sent messages so that they can’t be tracked down to any specific location.&lt;/p&gt;

&lt;p&gt;Tutanota is available as a web service and via native iOS and Android apps. The basic plan is absolutely free of charge, while premium and business setups come with a recurring fee.&lt;/p&gt;

&lt;h3&gt;
  
  
  Proofpoint
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67oa8ffnxc8lzmz0sjna.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67oa8ffnxc8lzmz0sjna.png" alt="Image description" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.proofpoint.com/" rel="noopener noreferrer"&gt;Proofpoint&lt;/a&gt; is an enterprise-level solution primarily suitable for large companies and organizations. It’s available as a Cloud service but can also be implemented on-site when required.&lt;/p&gt;

&lt;p&gt;Proofpoint comes with two-way encryption. All of your outgoing emails are end-to-end encrypted, while the same software protects you from potential attacks with incoming emails. The software offers policy-driven encryption that happens entirely under the hood. On top of that, features like data loss protection or streamlined storage are also available.&lt;/p&gt;

&lt;p&gt;The company doesn’t offer fixed pricing, each client can expect to be priced individually according to the features and capacity needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hushmail
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmqrkthsmxtqrq2bzqgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmqrkthsmxtqrq2bzqgb.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another software that we can definitely recommend for individuals and small/medium enterprises is &lt;a href="https://www.hushmail.com/" rel="noopener noreferrer"&gt;Hushmail&lt;/a&gt;. Depending on what you need, they probably have something in store.&lt;/p&gt;

&lt;p&gt;For individuals, Hushmail offers a regular email account with the @hushmail.com domain priced at $49.99/year. The account comes with 10GB of storage and an encryption relying on OpenPGP standard. Web and mobile (iOS only) access is available.&lt;/p&gt;

&lt;p&gt;Businesses can take advantage of dedicated plans for multiple users. When communicating with each user directly, end-to-end encryption covers all emails. Hushmail also offers on-demand encryption for messaging external users. Companies can also take advantage of secure web forms to be placed on websites or linked in emails. &lt;/p&gt;

&lt;p&gt;Business plans start at $5.99 per month for each user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Encyro
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0gqhpjvrsisja8avbjj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0gqhpjvrsisja8avbjj.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.encyro.com/" rel="noopener noreferrer"&gt;Encyro&lt;/a&gt; is a powerful service for protecting emails along with their attachments. Users don’t need to create separate email accounts – instead they get full encryption with their existing account. It’s quite an encryption with 16 layers of security that makes you compliant with all major privacy laws, such as HIPAA and GDPR (for other tools that can make you HIPAA-compliant, check out &lt;a href="https://mailtrap.io/blog/hipaa-compliant-email/#How_to_encrypt_emails_for_HIPAA_compliance" rel="noopener noreferrer"&gt;our dedicated article&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Encyro is free to use for individual accounts with a basic set of features. The Premium plan is available for $9.99/month and $7.99 for each additional user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sendinc
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjd4i6uc24evepd5728wq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjd4i6uc24evepd5728wq.png" alt="Image description" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another option worth considering is &lt;a href="https://www.sendinc.com/" rel="noopener noreferrer"&gt;Sendinc&lt;/a&gt;. It offers a 256-bit SSL encryption for all of your outgoing emails. You can use your existing email account with the service. To add an extra layer of security, Sendinc doesn’t store your keys, which guarantees only you and the recipients of your messages will be able to decrypt them.&lt;/p&gt;

&lt;p&gt;A free plan is available with up to 20 recipients per day and messages automatically vanishing after 7 days. To keep your emails and significantly boost the sending capacity, you’ll need to upgrade to a paid plan priced at $48/year for each user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enigmail
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzya6yokw06dyx1kjfqk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzya6yokw06dyx1kjfqk.png" alt="Image description" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.enigmail.net/" rel="noopener noreferrer"&gt;Enigmail&lt;/a&gt; is a different type of service than those we already described. It’s an add-on for Thunderbird and Postbox that encrypts both email content and its attachments. While doing so, it uses the OpenPGP standard for public-key encryption and signing outgoing emails.&lt;/p&gt;

&lt;p&gt;It’s a very simple tool but does exactly what you would require from an encryption tool without tons of additional features. Since it’s open-source, it comes free of charge without any limitations (except for those imposed by the respective email clients, of course).&lt;/p&gt;

&lt;h3&gt;
  
  
  TrendMicro
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue88rmzcpn8xug58bqdx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue88rmzcpn8xug58bqdx.png" alt="Image description" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.trendmicro.com/" rel="noopener noreferrer"&gt;TrendMicro&lt;/a&gt; is an enterprise solution that provides email encryption along with dozens of other features. These are aimed at protecting entire devices and networks from malware and data leaks. TrendMicro relies on cloud-based encryption with keys automatically managed in the Cloud. For additional security, the keys are automatically regenerated every month and distributed in a network.&lt;/p&gt;

&lt;p&gt;While TrendMicro offers individual pricing to its enterprise-level customers, it has a fixed price for less demanding clients. Their limited security plans (appropriately named ‘worry-free plans’) start from $37.75 per user and are paid annually.&lt;/p&gt;

&lt;h3&gt;
  
  
  NeoCertified
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1s6c76wfvdhnzv9o197q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1s6c76wfvdhnzv9o197q.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://neocertified.com/" rel="noopener noreferrer"&gt;NeoCertified&lt;/a&gt; is another solution for individuals and small business. It provides encryption for emails and attachments, and does it really well. When you send an email to external users, they’ll need to create a free NeoCertified account to access its contents. Of course, communication within the NC network is frictionless.&lt;/p&gt;

&lt;p&gt;The company offers very easy integration with the most popular email clients. The tool is priced at $99 per year for each account. A discount is available for non-profits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mailbox
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fklkfev9g295cih9doq6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fklkfev9g295cih9doq6k.png" alt="Image description" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To wrap up the list, there’s &lt;a href="https://mailbox.org/" rel="noopener noreferrer"&gt;Mailbox.org&lt;/a&gt;. It’s a simple and yet powerful tool for email encryption. On top of that, it offers a suite of office tools, such as cloud storage, calendar, or a task list. All of the data you input in any of these tools is encrypted.&lt;/p&gt;

&lt;p&gt;Personal accounts at Mailbox cost only €1 per month. More advanced plans start from €2.5 per user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;This wraps up our summary of the encryption tools we recommend in the upcoming year. We hope you enjoyed it and to see you next time. We write a lot about emails and their security, in particular. Follow our blog so you never miss a thing. Take care!&lt;/p&gt;

&lt;p&gt;Article by&lt;br&gt;
&lt;strong&gt;Piotr Malek&lt;/strong&gt;&lt;br&gt;
Technical Content Writer @ Mailtrap&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to know what are the &lt;a href="https://mailtrap.io/blog/email-encryption-software/" rel="noopener noreferrer"&gt;best email encryption software&lt;/a&gt;. Follow Mailtrap Blog for more articles on the related topics!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>8 Best Responsive HTML Email Builders for Your Next Campaign</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Thu, 24 Oct 2024 09:29:43 +0000</pubDate>
      <link>https://dev.to/idjuric660/8-best-responsive-html-email-builders-for-your-next-campaign-41h</link>
      <guid>https://dev.to/idjuric660/8-best-responsive-html-email-builders-for-your-next-campaign-41h</guid>
      <description>&lt;p&gt;How do you usually choose a new tool? Intuition? Friend’s recommendation? We prefer to make decisions based on data. That’s why we’ve prepared this research for you.&lt;/p&gt;

&lt;p&gt;Email HTML builders can help you create effective emails to increase your return on investment (ROI) — which currently stands at &lt;a href="https://www.barilliance.com/email-marketing-statistics/" rel="noopener noreferrer"&gt;$38 for every $1 spent&lt;/a&gt; — and convert your leads to loyal customers. &lt;/p&gt;

&lt;p&gt;Whether you’re a developer or a marketer, this guide will help you know how to choose a tool that fits your needs from hundreds of options.&lt;/p&gt;

&lt;p&gt;We’ll look at eight of the best responsive HTML email builders and how you can choose the correct tool for your email marketing needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Choose the Correct HTML Email Builder
&lt;/h2&gt;

&lt;p&gt;When you start building HTML emails, you should first understand what your business and customer needs. And the first goal an HTML email builder should help you achieve is creating responsive emails that give customers great experiences. &lt;/p&gt;

&lt;p&gt;So, when choosing an email builder, look for one with a user-friendly interface that offers reasonable pricing and extra features like an illustrations library. &lt;/p&gt;

&lt;p&gt;With that in mind, here are some questions to ask yourself before selecting an HTML email builder:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do you need to edit the email code?&lt;/li&gt;
&lt;li&gt;Do you use an email marketing platform? If yes, starting with its built-in email editor can be a good start.&lt;/li&gt;
&lt;li&gt;How often do you create new email templates? Daily, weekly, monthly, or a couple of times per year?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;​​When searching for an HTML email builder, you will find four main types of options. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML email generators&lt;/strong&gt;. This type of tool is designed mostly for developers who are building the email functionality and need to create simple solutions without too much effort. They help to convert your input to the correct HTML (or sometimes another) format and compile it for further usage as a template. The result then can be imported to the email sending system or pasted to your app source code. HTML email generators are similar to the template engines. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Responsive email frameworks&lt;/strong&gt;. Email framework is the best option for developers. Usually, it is a markup-based language where your code is later converted to a responsive HTML. &lt;a href="https://mailtrap.io/blog/best-email-frameworks/" rel="noopener noreferrer"&gt;Email frameworks&lt;/a&gt; offer pre-built options and various components to streamline email coding. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Built-in email templates&lt;/strong&gt;. The vast majority of the email sending systems have their built-in email template builders. In most cases, they provide decent functionality for designing tailored templates. Also, they can support the import of custom templates or writing your HTML from scratch. If you need advanced features, you can use a third-party email building tool, and then import the result to your email sending system. However, it would be pretty weird to create a template in one ESP (email sending provider) and send it with another. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Independent HTML email builders&lt;/strong&gt;. This category of tools offers wide functionality for creating custom and pre-defined templates for both developers and marketers. They provide drag and drop email builders, HTML email editors, image libraries, and usually can be integrated with the most popular ESPs and CRM systems. &lt;/p&gt;

&lt;p&gt;Drag and drop editor doesn’t require any additional skills: you work with pre-designed blocks to add images and edit texts like in a usual document. In most cases, you can switch to a source HTML code to edit it if you need to customize the design. &lt;/p&gt;

&lt;p&gt;Let’s now look at the eight best responsive HTML email builders you can use for your next &lt;a href="https://mailtrap.io/blog/email-marketing/" rel="noopener noreferrer"&gt;email marketing campaign&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best HTML Email Builders: Price Comparison Table
&lt;/h2&gt;

&lt;p&gt;Here’s a quick price comparison of the best HTML email builders before we dive into the details of each:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzygp4t9g00se5n23tcas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzygp4t9g00se5n23tcas.png" alt="Image description" width="800" height="996"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8 Best Responsive HTML Email Builders
&lt;/h2&gt;

&lt;p&gt;It can take time to choose an email builder that suits your needs from the hundreds of tools available on the market. That’s why we researched and compared seven responsive email builders to make your work easier. &lt;/p&gt;

&lt;p&gt;Here’s what we considered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suitability to both developers’ and marketers’ needs;&lt;/li&gt;
&lt;li&gt;Friendly user interface;&lt;/li&gt;
&lt;li&gt;Availability of free options or trials and pricing/features ratio;&lt;/li&gt;
&lt;li&gt;Additional options like photo editor and libraries;&lt;/li&gt;
&lt;li&gt;Compatibility and integrations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s go through the list of tools one by one.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.sender.net/" rel="noopener noreferrer"&gt;Sender&lt;/a&gt; — Best HTML Email Builder
&lt;/h3&gt;

&lt;p&gt;Sender is one of the best responsive HTML email builders to create, send, and automate your marketing emails. The software offers a drag-and-drop editor that helps you build responsive emails, popups, and forms effortlessly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiqlov4tvupmv579ojygf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiqlov4tvupmv579ojygf.png" alt="Image description" width="800" height="581"&gt;&lt;/a&gt;&lt;br&gt;
Image source: &lt;a href="http://www.sender.net/" rel="noopener noreferrer"&gt;Sender&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The platform also has a library of premade free templates, such as &lt;a href="https://www.optimonk.com/reducing-shopping-cart-abandonment-rate-definitive-guide/" rel="noopener noreferrer"&gt;cart abandonment&lt;/a&gt; and welcome email templates, with all the elements you need to create stunning email campaigns that convert. &lt;/p&gt;

&lt;p&gt;If you have coding skills, Sender allows you to design responsive HTML email templates to offer unique experiences to your subscribers.&lt;/p&gt;

&lt;p&gt;The software also offers automation, reporting &amp;amp; analytics, and smart segmentation to help you target your audience with automated sequences to increase engagement.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sender Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that Sender offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drag-and-drop email editor that helps you build responsive emails to increase engagement and sales;&lt;/li&gt;
&lt;li&gt;Popups and signup forms to help you &lt;a href="https://www.optimonk.com/lead-capture/" rel="noopener noreferrer"&gt;capture hot leads&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;Marketing automation to enable you to reach your audience via email and SMS channels automatically;&lt;/li&gt;
&lt;li&gt;Reporting &amp;amp; analytics to help you monitor crucial email and SMS marketing metrics.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Sender Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts from $8 per month for up to 2500 subscribers and 30,000 emails;&lt;/li&gt;
&lt;li&gt;Free Forever plan is also available for up to 2500 subscribers and 15,000 emails per month.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="http://www.sendx.io/" rel="noopener noreferrer"&gt;SendX&lt;/a&gt; — Online Creation HTML Email Editor
&lt;/h3&gt;

&lt;p&gt;SendX is an email marketing software known for its high &lt;a href="https://mailtrap.io/blog/email-deliverability/" rel="noopener noreferrer"&gt;email deliverability&lt;/a&gt;. It allows you to create beautiful newsletters using your own email HTML code, the drag-and-drop email builder, or pre-made, fully customizable templates. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F20qmiwokz74p68lidclj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F20qmiwokz74p68lidclj.png" alt="Image description" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The best part is that you can use SendX with any industry (gaming, crypto, or casinos) as long as you send HTML emails to an engaged subscriber base. When you sign up, they’ll migrate you from your old platform for free within a few days. &lt;/p&gt;

&lt;h4&gt;
  
  
  SendX Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that SendX offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy drag-and-drop email builder to create visually appealing emails without knowing how to code;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://mailtrap.io/blog/ab-testing-email/" rel="noopener noreferrer"&gt;A/B testing&lt;/a&gt;, tagging, segmentation, personalization, and many such features in SendX to help you run email marketing campaigns; &lt;/li&gt;
&lt;li&gt;Offers integration with 5000 apps on Zapier, so you can automate your workflow and save time for strategy; &lt;/li&gt;
&lt;li&gt;There are 50+ proven-to-convert templates for &lt;a href="https://woorise.com/best-landing-page-builders" rel="noopener noreferrer"&gt;landing pages&lt;/a&gt; and signup forms to grow your audience;&lt;/li&gt;
&lt;li&gt;High email deliverability, even for bulk promotional emails, making email marketing profitable for your business.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  SendX Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts at $9.99 per month for up to 1000 subscribers; &lt;/li&gt;
&lt;li&gt;Free trial plan available with limited features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://stripo.email/" rel="noopener noreferrer"&gt;Stripo&lt;/a&gt; — Email Design Platform
&lt;/h3&gt;

&lt;p&gt;Stripo is a drag-and-drop email template builder that offers a wide range of features to help you design your emails and send them through an email service provider (ESP).&lt;/p&gt;

&lt;p&gt;Stripo offers the most extensive list of customizable elements compared to other template-building tools — not only templates and blocks but also modules and structures. You can also switch to a CSS/HTML editor and copy and paste your code anytime. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fye5t4484y1hl4gh3gvz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fye5t4484y1hl4gh3gvz2.png" alt="Image description" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition to the cloud version, Stripo offers a JavaScript plugin, which you can embed in your application as a component.&lt;/p&gt;

&lt;h4&gt;
  
  
  Stripo Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that Stripo offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Responsive HTML editor with merge tags, emoji, and custom paddings;&lt;/li&gt;
&lt;li&gt;Image editor, where you can upload your own images or choose from the built-in stock images library;&lt;/li&gt;
&lt;li&gt;Embed video from YouTube or Vimeo;&lt;/li&gt;
&lt;li&gt;Options to display or hide elements on a desktop or mobile client and the ability to choose if to include it in both MIMe versions of the email (classic HTML and AMP HTML).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Stripo Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts at $15 per month for up to one user and 50 test emails a day;&lt;/li&gt;
&lt;li&gt;Free plan available with limited features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://unlayer.com/" rel="noopener noreferrer"&gt;Unlayer&lt;/a&gt; — HTML Email Template Builder for Outlook
&lt;/h3&gt;

&lt;p&gt;Unlayer is an email and page designer for creating HTML emails in Outlook. It’s a JavaScript plugin you embed into your web application. So, you won’t need any PHP, CSS, or HTML coding experience to create responsive email templates, as you can use the editor like a typical email designer.  &lt;/p&gt;

&lt;p&gt;Unlayer doesn’t offer pre-designed email templates, so you should create your own. You can build your template using the standard blocks (like images, dividers, or text) or add a custom one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhyoqa6e5mq5qfqp1rxek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhyoqa6e5mq5qfqp1rxek.png" alt="Image description" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Among Unlayer’s exciting features are merge tag support and the ability to save templates as a JSON file. &lt;/p&gt;

&lt;h4&gt;
  
  
  Unlayer Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that Unlayer offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WYSIWYG editor that helps you create engaging, professional emails and pages;&lt;/li&gt;
&lt;li&gt;Ready-to-go email templates to kickstart your design process; &lt;/li&gt;
&lt;li&gt;Manage and share templates with team members to collaborate and craft the perfect message.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Unlayer Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts from $20 per month with services such as mobile-ready campaigns, drag &amp;amp; drop builder, and free stock photos;&lt;/li&gt;
&lt;li&gt;Free plan with limited features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Beefree — Free HTML Mailer Template
&lt;/h3&gt;

&lt;p&gt;BEE stands for Best Email Editor. Behind this ambitious name, you’ll find a simple but powerful drag-and-drop editor for creating &lt;a href="https://designmodo.com/email-newsletter-templates/" rel="noopener noreferrer"&gt;HTML email newsletter templates&lt;/a&gt; on the go. You can also write your own HTML code and download the source code of the template you create with BEE tools. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fotka77h2h9brujrfgaav.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fotka77h2h9brujrfgaav.png" alt="Image description" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can create your emails from scratch or choose from the platform’s massive library of free templates sorted by categories and industries. You’ll have many options for customizing templates, such as: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Experimenting with text and setting custom paddings;&lt;/li&gt;
&lt;li&gt;Uploading your own image, editing it in the app, or choosing from the stock library;&lt;/li&gt;
&lt;li&gt;Embedding a YouTube or Vimeo video.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Beefree Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that Beefree offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free email template builder for creating emails that get high open and click rates;&lt;/li&gt;
&lt;li&gt;Insert merge tags or special links for Mailchimp, Sendgrid, MailUp, Autopilot, and Campaign Monitor;&lt;/li&gt;
&lt;li&gt;Write your own HTML5 email code and download the source code of the template you create with the BEE tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Beefree Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts from $30 per month for unlimited emails, pages, folders and reusable blocks;&lt;/li&gt;
&lt;li&gt;Free plan is also available with limited features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://designmodo.com/postcards/" rel="noopener noreferrer"&gt;Postcards&lt;/a&gt; by Desingmodo — Responsive Newsletter HTML Editor
&lt;/h3&gt;

&lt;p&gt;Postcards is an intuitive drag-and-drop newsletter HTML template builder that offers pre-designed blocks you can combine and customize to create your ideal template.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdmk7nu6rv997mk8wkt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdmk7nu6rv997mk8wkt1.png" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The blocks are designed like mini-templates and categorized by purpose: e-commerce, transactional, call to action, etc. As a result, you can easily:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Format your text and tables;&lt;/li&gt;
&lt;li&gt;Upload images from your computer;&lt;/li&gt;
&lt;li&gt;Organize your templates into projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The platform also has an email tester feature to help you preview emails from the desktop and mobile view to ensure they’re responsive.&lt;/p&gt;

&lt;h4&gt;
  
  
  Postcard Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that Postcard offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drag &amp;amp; drop template builder;&lt;/li&gt;
&lt;li&gt;Add images, links, and texts using intuitive Postcards HTML email editor;&lt;/li&gt;
&lt;li&gt;One-click export to HubSpot, Mailchimp or as plain HTML;&lt;/li&gt;
&lt;li&gt;900+ Google Fonts to complement your email designs perfectly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Postcard Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts from $24 per month for up to 20 exports per month;&lt;/li&gt;
&lt;li&gt;Free plan is also available with limited features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.newslettercreator.com/software-pricing/" rel="noopener noreferrer"&gt;Mailstyler&lt;/a&gt; — HTML Mail Designer Tool
&lt;/h3&gt;

&lt;p&gt;Mailstyler is a desktop application for building email marketing templates for Windows. The Mailstyler HTML editor helps you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edit and format email, texts and styles;&lt;/li&gt;
&lt;li&gt;Experiment with blocks;&lt;/li&gt;
&lt;li&gt;Upload your own image, edit, and resize it in the app, or choose from the MailStyler library.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmnro176c6uxqli0truca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmnro176c6uxqli0truca.png" alt="Image description" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In general, MailStyler offers a comprehensive list of template options to create HTML emails you can export in Outlook or Thunderbird or even convert to PDF. &lt;/p&gt;

&lt;h4&gt;
  
  
  Mailstyler Key Features
&lt;/h4&gt;

&lt;p&gt;Here are some of the key features that Mailstyler offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Email editor that allows for HTML email styling to create stunning emails;&lt;/li&gt;
&lt;li&gt;Fully-customizable dynamic blocks with elements such as mail to button, email footer, and email signature to ensure newsletters are branded well;&lt;/li&gt;
&lt;li&gt;Export your email templates directly to Outlook, Gmail, and Thunderbird.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Mailstyler Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starts at $99 per year for one installation;&lt;/li&gt;
&lt;li&gt;Free demo with limited features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.mailmodo.com/" rel="noopener noreferrer"&gt;Mailmodo&lt;/a&gt; – Great HTML Email Builder
&lt;/h3&gt;

&lt;p&gt;Mailmodo is a complete email marketing solution that lets you create and send interactive emails within minutes with its no-code editor. &lt;/p&gt;

&lt;p&gt;You can create campaigns, manage email lists, personalize content, explore ready-to-use templates, save and reuse blocks, and track performance with smart reports – all at the same place. Mailmodo can also integrate with multiple CRMs to manage your workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7y4o5cziq2azgtzv0uut.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7y4o5cziq2azgtzv0uut.png" alt="Image description" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Mailmodo Key Features
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Create and send interactive AMP and HTML emails with our no-code email builder.&lt;/li&gt;
&lt;li&gt;Offers 20+ interactive AMO widgets such as carousels, polls, quiz, spin the wheel, shopping carts, and so on.&lt;/li&gt;
&lt;li&gt;Customize 200+ pre-made email templates.&lt;/li&gt;
&lt;li&gt;100+ Pre-made blocks – headers, footers, layouts, and CTA buttons.&lt;/li&gt;
&lt;li&gt;A fallback version is automatically added if the email client doesn’t support AMP emails.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Mailmodo Pricing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Plans start at $99 per month for up to 40,000 contacts.&lt;/li&gt;
&lt;li&gt;Free 21 days trial available.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaways on the Best Responsive HTML Email Builders
&lt;/h2&gt;

&lt;p&gt;There you have it. Eight different email template builders with HTML code and drag-and-drop interface options. &lt;/p&gt;

&lt;p&gt;The most common feature the tools have is each one allows you to build stunning email templates you can send to subscribers and boost engagement.&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to know about different drag and drop email builders. To read more articles on the related topics, follow &lt;a href="https://mailtrap.io/blog/best-email-builders/" rel="noopener noreferrer"&gt;Mailtrap blog&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Gomail Guide: Configuration, SMTP Setup, and Email Sending</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Thu, 10 Oct 2024 09:30:28 +0000</pubDate>
      <link>https://dev.to/idjuric660/gomail-guide-configuration-smtp-setup-and-email-sending-34g9</link>
      <guid>https://dev.to/idjuric660/gomail-guide-configuration-smtp-setup-and-email-sending-34g9</guid>
      <description>&lt;p&gt;In this article, I break down my email-sending flow with Gomail, a super straightforward package for Golang. Of course, I’ve made sure to include code snippets ready for use.&lt;/p&gt;

&lt;p&gt;I’ll also cover debugging and testing so you can make sure your code is working perfectly after following this guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to install Gomail
&lt;/h2&gt;

&lt;p&gt;If you haven’t already, make sure to download Go 1.2 or newer from the &lt;a href="https://go.dev/doc/install" rel="noopener noreferrer"&gt;official website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then, proceed to install Gomail by running the following command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go get gopkg.in/mail.v2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, you can include it in your project or application with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import gomail "gopkg.in/mail.v2"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Useful links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/go-gomail/gomail" rel="noopener noreferrer"&gt;Documentation on GitHub.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pkg.go.dev/gopkg.in/gomail.v2?utm_source=godoc#example-package" rel="noopener noreferrer"&gt;Sending examples on Go.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to send email using Gomail and SMTP
&lt;/h2&gt;

&lt;p&gt;For starters, let’s send a plain text message. Here’s a code snippet you can paste into your main configuration file (e.g., &lt;strong&gt;main.go&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "fmt"
    gomail "gopkg.in/mail.v2"
)

func main() {
    // Create a new message
    message := gomail.NewMessage()

    // Set email headers
    message.SetHeader("From", "youremail@email.com")
    message.SetHeader("To", "recipient1@email.com")
    message.SetHeader("Subject", "Hello from the Mailtrap team")

    // Set email body
`    message.SetBody("text/plain", "This is the Test Body")

    // Set up the SMTP dialer
    dialer := gomail.NewDialer("live.smtp.mailtrap.io", 587, "api", "1a2b3c4d5e6f7g")

    // Send the email
    if err := dialer.DialAndSend(message); err != nil {
        fmt.Println("Error:", err)
        panic(err)
    } else {
        fmt.Println("Email sent successfully!")
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run the script, simply execute go run.main.go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code breakdown&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;**NewDialer**&lt;/code&gt; – Initiates a new SMTP connection, specifying the mail server address, &lt;a href="https://mailtrap.io/blog/smtp-ports-25-465-587-used-for/" rel="noopener noreferrer"&gt;port number&lt;/a&gt;, and credentials (username and password) to authenticate (auth) the sender.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**NewMessage**&lt;/code&gt; – Creates a new email message you can customize.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;SetHeader&lt;/code&gt;&lt;/strong&gt; – Sets specific headers such as “From”, “To”, and “Subject,” defining the sender, recipient, and &lt;a href="https://mailtrap.io/blog/email-subject-line-testers/" rel="noopener noreferrer"&gt;subject line&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**SetBody**&lt;/code&gt; – Defines the content of the email body, which is plain text in this example.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;DialAndSend&lt;/code&gt;&lt;/strong&gt; – Establishes a connection and sends the email.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, as you can notice, I’m using &lt;a href="https://mailtrap.io/smtp-service/" rel="noopener noreferrer"&gt;Mailtrap SMTP&lt;/a&gt;, a reliable SMTP with robust sending capabilities that ensures my emails reach recipients’ inboxes. It has a high sending throughput and comes with in-depth analytics, dedicated IPs, and other features that help me optimize my email infrastructure.&lt;/p&gt;

&lt;p&gt;Oh, and yes, there’s a free plan that lets you try all these features out, so be sure to check it out!&lt;/p&gt;

&lt;h3&gt;
  
  
  Send HTML email
&lt;/h3&gt;

&lt;p&gt;Sending an HTML email with Gomail is super easy as all you have to do is modify the &lt;strong&gt;&lt;code&gt;SetBody&lt;/code&gt;&lt;/strong&gt; method by changing the MIME type from &lt;strong&gt;“text/plain”&lt;/strong&gt; to &lt;strong&gt;“text/html”&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "fmt"
    gomail "gopkg.in/mail.v2"
)

func main() {
    // Create a new message
    message := gomail.NewMessage()

    // Set email headers
    message.SetHeader("From", "youremail@email.com")
    message.SetHeader("To", "recipient1@email.com")
    message.SetHeader("Subject", "Hello from the Mailtrap team")

    // Set email body to HTML format
    message.SetBody("text/html", `
        &amp;lt;html&amp;gt;
            &amp;lt;body&amp;gt;
                &amp;lt;h1&amp;gt;This is a Test Email&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Hello!&amp;lt;/b&amp;gt; This is a test email with HTML formatting.&amp;lt;/p&amp;gt;
                &amp;lt;p&amp;gt;Thanks,&amp;lt;br&amp;gt;Mailtrap&amp;lt;/p&amp;gt;
            &amp;lt;/body&amp;gt;
        &amp;lt;/html&amp;gt;
    `)

    // Set up the SMTP dialer
    dialer := gomail.NewDialer("live.smtp.mailtrap.io", 587, "api", "1a2b3c4d5e6f7g")

    // Send the email
    if err := dialer.DialAndSend(message); err != nil {
        fmt.Println("Error:", err)
        panic(err)
    } else {
        fmt.Println("HTML Email sent successfully!")
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro tips&lt;/strong&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I recommend writing your HTML code within the string passed to &lt;strong&gt;&lt;code&gt;SetBody&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To ensure better readability for multiline HTML content, enclose the HTML in backticks (`).&lt;/li&gt;
&lt;li&gt;Another common practice is to attach a plain text version of your HTML message, just in case some of your recipients’ clients don’t support HTML.&lt;/li&gt;
&lt;li&gt;- For this, you can use the &lt;strong&gt;&lt;code&gt;AddAlternative&lt;/code&gt;&lt;/strong&gt; function:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
m.SetBody( "text/html", "&lt;/p&gt;
&lt;p&gt;Hello!&lt;/p&gt;")

&lt;p&gt;m.AddAlternative("text/plain", "Hello!")&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://mailtrap.io/register/signup" rel="noopener noreferrer"&gt;Send Emails with Mailtrap for Free&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Send email to multiple recipients
&lt;/h3&gt;

&lt;p&gt;If you have multiple recipients, simply add their addresses in the “To” field under the &lt;code&gt;**SetHeader**&lt;/code&gt; method. Of course, don’t forget to separate them with commas.&lt;/p&gt;

&lt;p&gt;Check it out:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "fmt"&lt;br&gt;
    gomail "gopkg.in/mail.v2"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    // Create a new message&lt;br&gt;
    message := gomail.NewMessage()&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Set email headers with multiple recipients
message.SetHeader("From", "youremail@email.com")
message.SetHeader("To", "abc@gmail.com", "xyz@gmail.com", "123@gmail.com")  // Multiple recipients
message.SetHeader("Subject", "Test Email to Multiple Recipients")

// Set email body
message.SetBody("text/html", `
    &amp;lt;html&amp;gt;
        &amp;lt;body&amp;gt;
            &amp;lt;h1&amp;gt;This is a Test Email&amp;lt;/h1&amp;gt;
            &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Hello!&amp;lt;/b&amp;gt; This is a test email sent to multiple recipients.&amp;lt;/p&amp;gt;
            &amp;lt;p&amp;gt;Thanks,&amp;lt;br&amp;gt;Mailtrap&amp;lt;/p&amp;gt;
        &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
`)

// Set up the SMTP dialer
dialer := gomail.NewDialer("live.smtp.mailtrap.io", 587, "api", "1a2b3c4d5e6f7g")

// Send the email
if err := dialer.DialAndSend(message); err != nil {
    fmt.Println("Error:", err)
    panic(err)
} else {
    fmt.Println("Email sent successfully to multiple recipients!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Additionally, you can use the &lt;a href="https://mailtrap.io/blog/cc-bcc-in-smtp/" rel="noopener noreferrer"&gt;Cc and Bcc&lt;/a&gt; to send carbon copy or blind carbon copy emails, like so:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
message.SetHeader("Cc", "ccperson@example.com")&lt;br&gt;
message.SetHeader("Bcc", "bccperson@example.com")&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Send email with attachments
&lt;/h3&gt;

&lt;p&gt;When it comes to attachments, Gomail is really hard not to appreciate. To add an attachment to your email, just move the image/document to your project folder and specify its name under the &lt;code&gt;**Attach**&lt;/code&gt; method. &lt;/p&gt;

&lt;p&gt;Let’s say we want to add an invoice to our email. Simply copy the &lt;strong&gt;invoice#1.pdf&lt;/strong&gt;, and specify its filename in the code, like so:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "fmt"&lt;br&gt;
    gomail "gopkg.in/mail.v2"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    // Create a new message&lt;br&gt;
    message := gomail.NewMessage()&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Set email headers
message.SetHeader("From", "youremail@email.com")
message.SetHeader("To", "abc@gmail.com")
message.SetHeader("Subject", "Test Email with Attachment")

// Set email body
message.SetBody("text/html", `
    &amp;lt;html&amp;gt;
        &amp;lt;body&amp;gt;
            &amp;lt;h1&amp;gt;This is a Test Email&amp;lt;/h1&amp;gt;
            &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Hello!&amp;lt;/b&amp;gt; Please find the attachment below.&amp;lt;/p&amp;gt;
            &amp;lt;p&amp;gt;Thanks,&amp;lt;br&amp;gt;Mailtrap&amp;lt;/p&amp;gt;
        &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
`)

// Add attachments
message.Attach("/invoice#1.pdf")

// Set up the SMTP dialer
dialer := gomail.NewDialer("live.smtp.mailtrap.io", 587, "api", "1a2b3c4d5e6f7g")

// Send the email
if err := dialer.DialAndSend(message); err != nil {
    fmt.Println("Error:", err)
    panic(err)
} else {
    fmt.Println("Email sent successfully with attachments!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Send email with embedded image
&lt;/h3&gt;

&lt;p&gt;If you want to display an image inline rather than as an attachment, you can use the &lt;strong&gt;&lt;code&gt;Embed()&lt;/code&gt;&lt;/strong&gt; method, which attaches it directly within the email body.&lt;/p&gt;

&lt;p&gt;Here’s a code snippet you can use:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "fmt"&lt;br&gt;
    gomail "gopkg.in/mail.v2"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    // Create a new message&lt;br&gt;
    message := gomail.NewMessage()&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Set email headers
message.SetHeader("From", "youremail@email.com")
message.SetHeader("To", "abc@gmail.com")
message.SetHeader("Subject", "Test Email with Embedded Image")

// Embed image and set email body to reference the embedded image
message.Embed("/path/to/image.jpg", "image123")

message.SetBody("text/html", `
    &amp;lt;html&amp;gt;
        &amp;lt;body&amp;gt;
            &amp;lt;h1&amp;gt;Test Email with Embedded Image&amp;lt;/h1&amp;gt;
            &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Hello!&amp;lt;/b&amp;gt; This email contains an embedded image:&amp;lt;/p&amp;gt;
            &amp;lt;img src="cid:image123" alt="Embedded Image"&amp;gt;
            &amp;lt;p&amp;gt;Thanks,&amp;lt;br&amp;gt;Mailtrap&amp;lt;/p&amp;gt;
        &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
`)

// Set up the SMTP dialer
dialer := gomail.NewDialer("live.smtp.mailtrap.io", 587, "api", "1a2b3c4d5e6f7g")

// Send the email
if err := dialer.DialAndSend(message); err != nil {
    fmt.Println("Error:", err)
    panic(err)
} else {
    fmt.Println("Email sent successfully with an embedded image!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Asynchronous email sending
&lt;/h3&gt;

&lt;p&gt;As it’s synchronous by nature, Gomail isn’t really the best bet for sending multiple emails concurrently. However, &lt;a href="https://go.dev/tour/concurrency/1" rel="noopener noreferrer"&gt;goroutines&lt;/a&gt;, a lightweight thread managed by Go, allows us to get past this by calling &lt;code&gt;**go sendAsyncEmail(recipient, dialer)**&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Check out how it works:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "fmt"&lt;br&gt;
    "gopkg.in/mail.v2"&lt;br&gt;
    "time"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;func sendAsyncEmail(recipient string, dialer *mail.Dialer) {&lt;br&gt;
    // Create a new message&lt;br&gt;
    message := mail.NewMessage()&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Set email headers
message.SetHeader("From", "your.email@example.com")
message.SetHeader("To", recipient)
message.SetHeader("Subject", "Async Email Example")
message.SetBody("text/plain", "This is an asynchronously sent email!")

// Send email
if err := dialer.DialAndSend(message); err != nil {
    fmt.Println("Error sending email:", err)
} else {
    fmt.Println("Email sent to:", recipient)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    // Configure the SMTP dialer&lt;br&gt;
    dialer := mail.NewDialer("live.smtp.mailtrap.io", 587, "username", "password")&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// List of recipients
recipients := []string{"recipient1@example.com", "recipient2@example.com", "recipient3@example.com"}

// Loop over the recipient list and send emails asynchronously
for _, recipient := range recipients {
    go sendAsyncEmail(recipient, dialer) // Send email in a separate goroutine
}

// Wait for all emails to be sent
time.Sleep(5 * time.Second) // This gives enough time for goroutines to finish before exiting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Send bulk emails
&lt;/h3&gt;

&lt;p&gt;When it comes to bulk emails, the situation with Gomail is the same as for asynchronous sending and we have to use goroutines. &lt;/p&gt;

&lt;p&gt;Here’s a code snippet:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "fmt"&lt;br&gt;
    "gopkg.in/mail.v2"&lt;br&gt;
    "sync"&lt;br&gt;
    "time"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;func sendAsyncEmail(recipient string, dialer *mail.Dialer, wg *sync.WaitGroup, throttle &amp;lt;-chan time.Time) {&lt;br&gt;
    defer wg.Done() // Notify that this goroutine is done&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wait for the throttle to allow sending
&amp;lt;-throttle

// Create a new message
message := mail.NewMessage()

// Set email headers
message.SetHeader("From", "your.email@example.com")
message.SetHeader("To", recipient)
message.SetHeader("Subject", "Async Email Example")
message.SetBody("text/plain", "This is an asynchronously sent email!")

// Send email
if err := dialer.DialAndSend(message); err != nil {
    fmt.Println("Error sending email:", err)
} else {
    fmt.Println("Email sent to:", recipient)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    // Configure the SMTP dialer&lt;br&gt;
    dialer := mail.NewDialer("bulk.smtp.mailtrap.io", 587, "username", "password")&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// List of recipients (e.g., bulk list)
recipients := []string{"recipient1@example.com", "recipient2@example.com", "recipient3@example.com"}

// Create a WaitGroup to wait for all emails to be sent
var wg sync.WaitGroup

// Throttle to control the rate of email sending (1 email per second)
throttle := time.Tick(1 * time.Second)

// Loop over the recipient list and send emails asynchronously
for _, recipient := range recipients {
    wg.Add(1)
    go sendAsyncEmail(recipient, dialer, &amp;amp;wg, throttle) // Send email in a separate goroutine
}

// Wait for all goroutines to finish
wg.Wait()
fmt.Println("All emails have been sent.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Notes&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;As opposed to the snippet from the previous chapter, we use &lt;code&gt;**sync.WaitGroup**&lt;/code&gt; instead of &lt;code&gt;**time.Sleep**&lt;/code&gt; so our app can perform under a heavier load.&lt;br&gt;
I’ve also added throttle control &lt;code&gt;**&amp;lt;-throttle**&lt;/code&gt; so you can choose how long the intervals between each email are going to be.&lt;br&gt;
Technically, you could also implement a retry logic with the &lt;code&gt;**sendEmailWithRetry**&lt;/code&gt; function by wrapping it around &lt;code&gt;**DialAndSend**&lt;/code&gt;. However, be careful with it as too many retried attempts might negatively affect your &lt;a href="https://mailtrap.io/blog/email-sender-reputation/" rel="noopener noreferrer"&gt;sender reputation&lt;/a&gt; and overall deliverability.&lt;br&gt;
Lastly, I’ve used &lt;a href="https://help.mailtrap.io/article/113-sending-streams" rel="noopener noreferrer"&gt;Mailtrap Bulk Stream&lt;/a&gt;, which provides me with a dedicated stream for sending large amounts of emails while keeping my deliverability high.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexwox65t46rntreo3uah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexwox65t46rntreo3uah.png" alt="Image description" width="800" height="677"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, if your focus is on bulk sending, I should probably mention that Mailtrap has a bulk-aware &lt;a href="https://mailtrap.io/email-api/" rel="noopener noreferrer"&gt;email API&lt;/a&gt;. With it, you can send customized HTML emails to 1,000,000 recipients with a single API call. Most importantly, it will compile the information into emails itself!&lt;/p&gt;
&lt;h2&gt;
  
  
  Gomail debugging
&lt;/h2&gt;

&lt;p&gt;Done coding? Better not pack up, cause now I’ll show you the most common approaches to debugging in Gomail. ⚒️&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Error handling and logging using the &lt;code&gt;fmt.Println()&lt;/code&gt; statement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The simplest way to ensure your Gomail code is working correctly is to use the &lt;strong&gt;&lt;code&gt;fmt.Println()&lt;/code&gt;&lt;/strong&gt; statement. As you might have noticed, I’ve added it to all of the code blocks throughout this article to make it a bit easier for you.&lt;/p&gt;

&lt;p&gt;Nonetheless, here’s a dissected snippet for you to inspect:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
// Add error logging here for better debugging&lt;br&gt;
    if err := dialer.DialAndSend(message); err != nil {&lt;br&gt;
        fmt.Println("Failed to send email:", err)&lt;br&gt;
        // You can add more logging or error handling here if needed&lt;br&gt;
    } else {&lt;br&gt;
        fmt.Println("Email sent successfully!")&lt;br&gt;
    }&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Setting the Debug mode in dialer&lt;/strong&gt;
There’s also the &lt;strong&gt;&lt;code&gt;Debug&lt;/code&gt;&lt;/strong&gt; field provided by Gomail. You can use it to pass &lt;strong&gt;&lt;code&gt;io.Writer&lt;/code&gt;&lt;/strong&gt; (e.g., &lt;strong&gt;&lt;code&gt;os.Stdout&lt;/code&gt;&lt;/strong&gt;) and print SMTP communications, which makes it easy to see what’s going on under the hood.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
import "os"&lt;/p&gt;

&lt;p&gt;dialer := gomail.NewDialer("live.smtp.mailtrap.io", 587, "api", "1a2b3c4d5e6f7g")&lt;br&gt;
dialer.Debug = os.Stdout // Prints out the SMTP session communication&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Checking the SMTP configuration&lt;/strong&gt;
Although it’s not really a debugging method, I have to mention that if you’re facing issues and errors when trying to send emails, you should always check the SMTP configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Personally, not rarely have I failed to enter my credentials correctly and input the correct port number (looking at you, port 597 🫠).&lt;/p&gt;

&lt;p&gt;Additionally, you can log the SMTP details to make sure they’re correct:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
fmt.Printf("Using SMTP Server: %s, Port: %d, Username: %s\n", smtp_server, port, login)&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;“X509: certificate signed by unknown authority”&lt;/strong&gt;
If you’re seeing this error, the client running Gomail is likely not considering the SMTP server’s certificate to be valid. A simple fix would be to use &lt;strong&gt;&lt;code&gt;SetTLSConfig&lt;/code&gt;&lt;/strong&gt; and bypass the server’s certificate chain:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
package main&lt;/p&gt;

&lt;p&gt;import (&lt;br&gt;
    "crypto/tls"&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"gopkg.in/gomail.v2"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    d := gomail.NewDialer("smtp.example.com", 587, "user", "123456")&lt;br&gt;
    d.TLSConfig = &amp;amp;tls.Config{InsecureSkipVerify: true}&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Send emails using d.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Test email and email sending on staging
&lt;/h2&gt;

&lt;p&gt;Debugging is only one part of making sure your email-sending functionality works. However, there’s more to it, like ensuring your messages look how you want them to or that they’re reaching your recipient’s primary inboxes instead of spam folders.&lt;/p&gt;

&lt;p&gt;Gomail doesn’t offer an in-built solution for this, but fortunately, there’s &lt;a href="https://mailtrap.io/email-sandbox/" rel="noopener noreferrer"&gt;Mailtrap Email Testing&lt;/a&gt;, another inseparable part of Mailtrap Email Delivery platform, which I personally use and recommend.&lt;/p&gt;

&lt;p&gt;Mailtrap Email Testing allows me to inspect the HTML/CSS of my emails and easily fix faulty lines of code, preview my messages, and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg01ojkhuxopb3rsjyony.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg01ojkhuxopb3rsjyony.png" alt="Image description" width="800" height="1145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once I’m certain my HTML is flawless, I typically proceed to check my spam score. If I keep it below 5, I proactively prevent a lot of potential &lt;a href="https://mailtrap.io/blog/email-deliverability/" rel="noopener noreferrer"&gt;email deliverability&lt;/a&gt; issues my project could face once I move it to production.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqfdnbehh0waemngvv9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqfdnbehh0waemngvv9g.png" alt="Image description" width="800" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And I must admit, if you think that sending emails with Gomail is easy, wait till you see how straightforward it is to test emails with Mailtrap.&lt;/p&gt;

&lt;p&gt;{% embed &lt;a href="https://youtu.be/AveaJc6c3fI" rel="noopener noreferrer"&gt;https://youtu.be/AveaJc6c3fI&lt;/a&gt; %}&lt;/p&gt;

&lt;p&gt;To start testing, all you have to do is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;a href="https://mailtrap.io/register/signup" rel="noopener noreferrer"&gt;free Mailtrap account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Email Testing&lt;/strong&gt; and choose your inbox&lt;/li&gt;
&lt;li&gt;Find your credentials from the &lt;strong&gt;Integration&lt;/strong&gt; tab&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqf8g4k9362qny9sgtl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqf8g4k9362qny9sgtl0.png" alt="Image description" width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you obtain the credentials, simply copy/paste them into your Gomail configuration file. More specifically, the credentials in your &lt;strong&gt;&lt;code&gt;dialer&lt;/code&gt;&lt;/strong&gt;. Here’s what it should look like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
dialer := gomail.NewDialer("sandbox.smtp.mailtrap.io", 587, "your_mailtrap_username", "your_mailtrap_password")&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://mailtrap.io/register/signup" rel="noopener noreferrer"&gt;Test Emails with Mailtrap for Free&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, if you want to automate your testing process, you can use our &lt;a href="https://mailtrap.io/automated-email-testing/" rel="noopener noreferrer"&gt;Email Testing API&lt;/a&gt; and leverage it in Golang. For more information, check out the &lt;a href="https://api-docs.mailtrap.io/docs/mailtrap-api-docs/5tjdeg9545058-mailtrap-api" rel="noopener noreferrer"&gt;official docs&lt;/a&gt; or watch our video!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/j_wHPM4nuDw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Sending emails with Gomail really is the definition of short and sweet!&lt;/p&gt;

&lt;p&gt;However, if you want to sweeten things up a bit more, make sure to leverage Mailtrap’s email testing and sending capabilities, ensuring your emails land where you want them to: recipients’ primary folders. 📬&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to know how to send email in Gomail. To read more interesting articles on related topics, follow &lt;a href="https://mailtrap.io/blog/gomail/" rel="noopener noreferrer"&gt;Mailtrap blog&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Email Workflow Automation 101: Templates, Tools, and Best Practices</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Tue, 01 Oct 2024 10:57:09 +0000</pubDate>
      <link>https://dev.to/idjuric660/email-workflow-automation-101-templates-tools-and-best-practices-1mna</link>
      <guid>https://dev.to/idjuric660/email-workflow-automation-101-templates-tools-and-best-practices-1mna</guid>
      <description>&lt;p&gt;Email workflow automation takes over administrative tasks such as following up on sales inquiries, sending targeted promotions, and requesting feedback after a purchase. This helps teams save time, enhance productivity, and retain consistency across all communications.&lt;/p&gt;

&lt;p&gt;As you can imagine, this type of automation streamlines lead nurturing processes, increases conversion rates, and boosts engagement. Moreover, teams can focus more on crafting persuasive messages and building efficient pipelines.&lt;/p&gt;

&lt;p&gt;Let’s dive deeper into email workflow automation, explore popular tools, and discuss best practices that will help you get the most out of your campaigns.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is email workflow automation
&lt;/h2&gt;

&lt;p&gt;Email workflow automation is the process of leveraging software to send pre-defined emails based on user actions or specific events. &lt;/p&gt;

&lt;p&gt;User action is something that your visitors or customers may do while interacting with your brand. This includes downloading content from your platform, subscribing to the newsletter, or requesting a demo.&lt;/p&gt;

&lt;p&gt;To that, specific events are &lt;a href="https://mailtrap.io/blog/email-marketing-ideas/" rel="noopener noreferrer"&gt;holiday seasons&lt;/a&gt; or industry breakthroughs that necessitate sending offers or updates to the recipients.&lt;/p&gt;

&lt;p&gt;The key components of email workflow automation include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Triggers&lt;/strong&gt;: These are the events and user actions that initiate the workflow, like a user signing up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actions&lt;/strong&gt;: The automated task that the trigger executes, like sending a welcome email.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conditions&lt;/strong&gt;: Rules that define the criteria that need to be met before a mail is sent, like “if a new user signs up, send them the welcome email.”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sequences&lt;/strong&gt;: A series of emails sent over time that nurture emails, like a quick start guide email after the welcome message.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is great for lead nurturing, post-purchase follow-ups, onboarding sequences, and more. It allows teams to complete a lot of tedious, repetitive tasks in minutes or even seconds. &lt;/p&gt;

&lt;p&gt;Additionally, efficient email workflow automation can support &lt;a href="https://dealhub.io/glossary/revenue-recognition/" rel="noopener noreferrer"&gt;revenue recognition&lt;/a&gt; by ensuring timely communication and fulfillment updates that meet the conditions required to recognize revenue. For example, automated emails confirming product delivery or service completion help businesses promptly recognize revenue in line with accounting standards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Email workflow automation templates and examples
&lt;/h2&gt;

&lt;p&gt;Templates, as pre-built frameworks, help set the foundations of email workflow automation while still allowing room for customization.&lt;/p&gt;

&lt;p&gt;The four popular email workflow automation templates include:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Welcome email series
&lt;/h3&gt;

&lt;p&gt;The welcome email series is triggered when an interested prospect joins a mailing list or a customer makes their first purchase. These messages are crucial for introducing yourself, setting expectations, and engaging the new recipient.&lt;/p&gt;

&lt;p&gt;It establishes initial contact with your prospect or customer and provides them with resources they might need to learn about your offerings. This includes a quick thank you for choosing you, an introduction to the offerings and their configurations, and support content.&lt;/p&gt;

&lt;p&gt;In some cases, you can also send over a special offer to encourage the first purchase.&lt;/p&gt;

&lt;p&gt;Headspace, a mental health company, sends a warm welcome email that sets user expectations from the get-go:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyzvqkje5uzmnklm80wnm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyzvqkje5uzmnklm80wnm.png" alt="Image description" width="531" height="1600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Abandoned cart emails
&lt;/h3&gt;

&lt;p&gt;The abandoned cart emails remind your potential customers that they have chosen products or services they want to motivate them to complete the purchase. There can be several messages in such a campaign, such as regular reminders and &lt;a href="https://mailtrap.io/blog/amazon-sns-guide/" rel="noopener noreferrer"&gt;offer notifications&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This assists businesses in recovering lost sales by encouraging users to finish the checkout process.&lt;/p&gt;

&lt;p&gt;These emails contain a clear call-to-action (CTA) — a direct link to the cart, making it easier for the recipient to complete the purchase.&lt;/p&gt;

&lt;p&gt;Loftie, a wellness company that creates products to rest and relax, sends a coupon to encourage customers to complete the purchase:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3ycqv9df2g0g34s6ce7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3ycqv9df2g0g34s6ce7.png" alt="Image description" width="520" height="1600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Re-engagement campaigns
&lt;/h3&gt;

&lt;p&gt;Re-engagement campaigns are triggered when a subscriber hasn’t interacted with your brand or an existing customer hasn’t purchased in a while. The key objective is to pique the interest of the prospects again and ultimately &lt;a href="https://mailtrap.io/blog/customer-retention-email-template/" rel="noopener noreferrer"&gt;reduce churn rates&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;These email workflow automation campaigns are designed to win back leads or buyers’ attention. And it’s essential for teams to personalize the re-engagement emails if they’re to be impactful. &lt;/p&gt;

&lt;p&gt;Additionally, you can include a survey to learn why they have been inactive for a while.&lt;/p&gt;

&lt;p&gt;Duolingo, a popular app to help you learn new languages, motivates you to get back to work when you take a few days off:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06qqr7lgjskwacq58red.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06qqr7lgjskwacq58red.png" alt="Image description" width="760" height="1272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how they have incorporated various engaging elements such as a direct CTA to get back to your lessons, what other learners have achieved when you were away to create a sense of FOMO, and an encouraging message to push you to act.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Post-purchase follow up
&lt;/h3&gt;

&lt;p&gt;As the name suggests, the post-purchase follow-up email automation workflow is initiated when a customer completes a purchase. The messages may include questions that reveal insights about the checkout experience and &lt;a href="https://mailtrap.io/blog/email-feedback-loop/" rel="noopener noreferrer"&gt;feedback on the products&lt;/a&gt; or services leveraged.&lt;/p&gt;

&lt;p&gt;You can also offer product usage tips to enable the buyers to get the most out of their investment.&lt;/p&gt;

&lt;p&gt;The given actions bring the customers closer to your brand because they send empathetic signals. Such follow-ups can play a pivotal role in improving retention and boosting customer lifetime value (CLTV).&lt;/p&gt;

&lt;p&gt;Coffee Lab, a premium roaster, sends a heartfelt message after a customer makes a purchase and requests their feedback. Plus, there’s an option to get in touch via a chat feature. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1s2ha6xdzewj9xs5gc71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1s2ha6xdzewj9xs5gc71.png" alt="Image description" width="399" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create an automated email workflow
&lt;/h2&gt;

&lt;p&gt;I won’t dwell too much to lead you in but focus on a stepped approach you can immediately follow to create your workflow. So, here it is. &lt;/p&gt;

&lt;h3&gt;
  
  
  1. Define your goal
&lt;/h3&gt;

&lt;p&gt;The objectives of your automated email workflow can range from nurturing leads, educating current customers, and re-engaging inactive prospects. This informs the types of triggers you need to set and messages you need to send.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Identify triggers
&lt;/h3&gt;

&lt;p&gt;Determine the events that initiate your email sequences on a tangible level. These are usually IF-THEN statements. For instance, “if a visitor downloads a whitepaper, then send them a thank you email and offer a demo.”&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Segment your audience
&lt;/h3&gt;

&lt;p&gt;The leads in your pipeline might &lt;a href="https://mailtrap.io/blog/email-marketing-funnel/" rel="noopener noreferrer"&gt;not be ready to buy now&lt;/a&gt;. Moreover, each of them may want a different value from your brand. Therefore, it’s vital to group all the contacts in your database based on criteria like pain points, demographics, or purchase history. &lt;/p&gt;

&lt;p&gt;Doing that enables you to personalize your automated email workflow which increases its efficiency in making a sale.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Create and map out the email sequence
&lt;/h3&gt;

&lt;p&gt;Once the trigger is set, outline the email sequence for a particular audience segment. In the case of a new subscriber, for example, this could include a first welcome email, a follow-up to include additional resources, and a personalized offer.&lt;/p&gt;

&lt;p&gt;It’s crucial to be mindful of the timing here. You do not want to overwhelm your recipients with too many promotional messages.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Set conditions and actions
&lt;/h3&gt;

&lt;p&gt;The conditions are the email triggers and the actions are what your &lt;a href="https://mailtrap.io/blog/salesforce-email-automation/" rel="noopener noreferrer"&gt;email automation software&lt;/a&gt; is pre-programmed to do. As indicated earlier, these are the “IF” statements that determine the course of action in your email automation workflow when the conditions are met or unmet.&lt;/p&gt;

&lt;p&gt;For instance, “if the welcome email isn’t opened within three days, send a gentle reminder and decrease the lead score by 5 units.” Alternatively, “if the welcome email is opened in three days, send a follow-up with more resources and increase the lead score by 3 units.”&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Test the workflow
&lt;/h3&gt;

&lt;p&gt;As there are a lot of moving parts in a typical email automation workflow, teams should evaluate it in all aspects before setting it live. Testing also help spot areas of improvement, such as message enhancements.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Monitor and optimize
&lt;/h3&gt;

&lt;p&gt;Key performance indicators (KPIs) include &lt;a href="https://mailtrap.io/blog/calculate-email-open-rate/" rel="noopener noreferrer"&gt;open rates&lt;/a&gt;, click-through rates, and conversions. Keep in mind that the data is tracked with the permission of your prospects and customers to avoid legal fines and reputational damage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best practices while setting up email workflow automation
&lt;/h2&gt;

&lt;p&gt;Planning and implementing email workflow automation requires keen attention to detail while making data-backed decisions. Here are some best practices that will help you get started quickly in this journey:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Identify tangible metrics from the beginning
&lt;/h3&gt;

&lt;p&gt;Based on your goals for email workflow automation, recognize the measurable parameters that reflect the progress towards them. For instance, if your objective is to improve customer engagement, then you should focus on click-through rates.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Segment audience based on value
&lt;/h3&gt;

&lt;p&gt;As we mentioned earlier, each visitor on your website looks for a different value. Grouping them based on the common value makes it easier for you to write personalized messages. This increases the efficacy of your email campaigns and the &lt;a href="https://mailtrap.io/blog/email-marketing-metrics/" rel="noopener noreferrer"&gt;ROI of the overall automation workflow&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Personalize content with AI
&lt;/h3&gt;

&lt;p&gt;Speaking of personalization, artificial intelligence (AI) technologies can assist in summarizing a client’s profile including past interactions to suggest replies. So, you can write messages that resonate better with your audience without sacrificing productivity.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Space emails out strategically
&lt;/h3&gt;

&lt;p&gt;Nobody wants to hear from a business every day, even if their products are amazing and services are best in class. A good rule of thumb is to schedule your messages 2-4 days apart in your email workflow automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  3 best email workflow automation software for businesses
&lt;/h2&gt;

&lt;p&gt;Useful email workflow automation software allows teams to focus on writing and sending messages that deliver value to their recipients and boost sales. Here are three tools that businesses can consider:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Klaviyo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivret3zex99ro9k4vd4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivret3zex99ro9k4vd4a.png" alt="Image description" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.klaviyo.com/email-marketing" rel="noopener noreferrer"&gt;Klaviyo&lt;/a&gt; is a marketing automation platform primarily designed for eCommerce businesses. It has become a popular choice among online retailers due to features like real-time segmentation, behavior tracking, and pre-built email workflows.&lt;/p&gt;

&lt;p&gt;Teams can quickly set up simple email automations such as welcome series, cart abandonment reminders, and post-purchase follow-ups. Of course, its intuitive interface also makes it easy to create custom workflows for specific use cases.&lt;/p&gt;

&lt;p&gt;The free tier allows businesses to store up to 250 contacts and send 500 emails per month. Paid plans begin at $20/month where users can access advanced functionalities. The price then changes based on the number of contacts and emails sent.&lt;/p&gt;

&lt;p&gt;Its robust features make it a great option for eCommerce businesses and online sellers. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. ActiveCampaign
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kgv1fov04nbr0ia3jn3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kgv1fov04nbr0ia3jn3.png" alt="Image description" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.activecampaign.com/" rel="noopener noreferrer"&gt;ActiveCampaign&lt;/a&gt; is a marketing automation platform that offers robust functionalities. Teams can integrate it seamlessly with their CRM solutions to segment their contacts and send personalized messages. The email workflow automation builder is intuitive and easy to use, even for non-technical professionals.&lt;/p&gt;

&lt;p&gt;The plans for ActiveCampaign begin from $19/month for 1,000 contacts with limited automation features.&lt;/p&gt;

&lt;p&gt;This solution is great for B2B marketing teams with extensive email workflow automation needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Mailchimp
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F104tjuttlybtc9uso4y3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F104tjuttlybtc9uso4y3.png" alt="Image description" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mailchimp.com/" rel="noopener noreferrer"&gt;Mailchimp&lt;/a&gt; is a popular email marketing platform that offers features like customizable templates, A/B testing, and audience segmentation. This can preferred by teams looking to automate their email workflows but also want a minimalist tool to streamline their marketing efforts.&lt;/p&gt;

&lt;p&gt;The free plan allows up to 500 contacts, with 1,000 sends per month. The premium plans are charged based on the number of contacts. The lowest tier begins at $13/month for 500 contacts with 10x the sending limit.&lt;/p&gt;

&lt;p&gt;Mailchimp can be a solid option for small businesses and startups with limited email marketing needs who need an easy-to-use tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Email workflow automation makes it easier for teams to send timely and relevant messages quickly to their customers. It also simplifies the process of personalizing messages to increase the overall effectiveness of email marketing.&lt;/p&gt;

&lt;p&gt;But, keep in mind that email workflow automation requires continuous iterations to remain effective over time. Track the relevant metrics such as open rates and conversion rates to discover areas of improvement.&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to know about &lt;a href="https://mailtrap.io/blog/email-workflow-automation/" rel="noopener noreferrer"&gt;email automation workflow template&lt;/a&gt;. For more interesting articles on related topics, follow Mailtrap blog!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Test Your WooCommerce Emails: Insights and Obstacles to Overcome</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Tue, 24 Sep 2024 13:13:01 +0000</pubDate>
      <link>https://dev.to/idjuric660/how-to-test-your-woocommerce-emails-insights-and-obstacles-to-overcome-58fa</link>
      <guid>https://dev.to/idjuric660/how-to-test-your-woocommerce-emails-insights-and-obstacles-to-overcome-58fa</guid>
      <description>&lt;p&gt;After weeks of research and some trial and error, I can firmly say – it is impossible to thoroughly test emails and email sending using any WooCommerce built-in features or plugins. &lt;/p&gt;

&lt;p&gt;To be clear –  both options offer some email testing features, but they’re pretty limited.&lt;/p&gt;

&lt;p&gt;Nevertheless, these features can still be helpful for some minimal email testing. &lt;/p&gt;

&lt;p&gt;So, in this guide, I’ll still cover them and show you how to use &lt;a href="https://mailtrap.io/email-sandbox/" rel="noopener noreferrer"&gt;Mailtrap Email Testing&lt;/a&gt; to test your emails and email sending correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining email testing and email sending testing
&lt;/h2&gt;

&lt;p&gt;Before we go any deeper into the topic, I want to clarify what email testing involves: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Testing of emails&lt;/strong&gt; is verifying that the content, layout, and functionality of emails render correctly across various email clients and devices. This ensures that messages are received and visually appear as intended.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing of email sending&lt;/strong&gt; focuses on ensuring the reliability and performance of your email delivery. This process checks that emails are not just sent but also reach the recipients’ inboxes and avoid spam filters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email testing in the context of WooCommerce&lt;/strong&gt; is crucial for ensuring that transactional emails, like order confirmations and shipping updates, are delivered and displayed correctly. This helps boost customer trust, delivers key order details, and improves the shopping experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To better understand these nuances, check out the video below: &lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/TGUMNsXXNio"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Test emails using WooCommerce Email Preview
&lt;/h2&gt;

&lt;p&gt;The WooCommerce built-in email preview allows you to only inspect how an email appears. You won’t be able to test email deliverability, get a spam analysis, check device compatibility, etc. &lt;/p&gt;

&lt;p&gt;This approach is practical when you are confident in your email-sending service, and you only need to check that the email template’s design correctly displays all its elements.&lt;/p&gt;

&lt;p&gt;Here is how you can quickly activate the built-in “Email Preview” feature: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Access WooCommerce Settings&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Navigate to your WordPress admin dashboard, click ‘WooCommerce’, and select ‘Settings’.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq2xohqz1k8pgspsoocby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq2xohqz1k8pgspsoocby.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Go to the Emails Tab&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Find and click on the ‘Emails’ tab, where all the types of emails WooCommerce sends are listed. Click the ‘Manage’ button for the email you wish to preview.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36hyuhnxbftxc2nf67f9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36hyuhnxbftxc2nf67f9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Preview the Email Template&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the selected WooCommerce email settings, you’ll find an option to preview your email template. This lets you see how the subject line, email body, and the rest of the layout will appear, helping ensure everything is formatted correctly before sending it out to customers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh09l93b1vzce4oqlgcf7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh09l93b1vzce4oqlgcf7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As mentioned earlier, this is just a simple email preview, and if you are a high-volume sender, it is always best to test email deliverability issues so they don’t impact your business.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test emails using a mailing plugin and Mailtrap
&lt;/h2&gt;

&lt;p&gt;With over three million downloads, &lt;a href="https://wordpress.org/plugins/wp-mail-smtp/" rel="noopener noreferrer"&gt;WP Mail SMTP&lt;/a&gt; is the most popular email plugin in the WordPress ecosystem. There is a good chance you already have it installed in your store – if not, here’s the &lt;a href="https://mailtrap.io/blog/wordpress-smtp-settings/#White-Glove-Setup" rel="noopener noreferrer"&gt;installation guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This plugin reconfigures WordPress to use a proper SMTP provider with host credentials instead of the default wp_mail() PHP mail function. To test emails, I simply indicate the fake SMTP server credentials of Mailtrap Email Testing in the plugin.&lt;/p&gt;

&lt;p&gt;This way, I can trap the email in a sandbox where I can inspect and debug it before it reaches recipients.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/AveaJc6c3fI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  SMTP
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;To install the plugin and start using it with Email Testing, follow these steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;a href="https://mailtrap.io/register/signup?ref=header" rel="noopener noreferrer"&gt;new account with Mailtrap&lt;/a&gt; and navigate to your first inbox by clicking ‘Email Testing’, ‘Inboxes’, then “My Inbox”. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgptiu0l3eepb2jdwwdxn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgptiu0l3eepb2jdwwdxn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once inside “My Inbox”, click “Show credentials” &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb7jis4g0uteh4bgme1h4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb7jis4g0uteh4bgme1h4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;a. Here, you will find your Email Testing SMTP/POP3 credentials that you’ll need to configure later in WP Mail SMTP plugin’s settings. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fx00kej8jkgwcw098lz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fx00kej8jkgwcw098lz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, from your WordPress admin dashboard, navigate to the ‘Plugins’ section and press ‘Add New’. &lt;/li&gt;
&lt;li&gt;Search for ‘WP Mail SMTP’, install it, and press ‘Activate’.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuw5hb0amnitjap7didu6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuw5hb0amnitjap7didu6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When the plugin is activated, navigate to its settings. Find the fields for ‘From Email’ and ‘From Name’ in the ‘General’ settings and fill them out.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w8qpj2s5xeu5he1hyph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w8qpj2s5xeu5he1hyph.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After that, scroll to the section labeled ‘Mailer’ and select ‘Other SMTP’. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsh532ur912739zwyiz65.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsh532ur912739zwyiz65.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scroll down to add credentials for ‘Other SMTP’, and start copy-pasting Mailtrap Email Testing SMTP credentials into the designated fields:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SMTP Host&lt;/strong&gt;: sandbox.smtp.mailtrap.io&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encryption&lt;/strong&gt;: SSL or TLS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMTP Port&lt;/strong&gt;: 25 or 465 or 587 or 2525 (will be filled out automatically once you choose encryption)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: toggle On &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMTP Username&lt;/strong&gt;: your Mailtrap username&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMTP Password&lt;/strong&gt;: your Mailtrap password&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftb6h2ptlp3x4w2p4v4lr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftb6h2ptlp3x4w2p4v4lr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the ‘Save Settings’ button; you’ll see the confirmation notifications at the top of the WP Mail SMTP General tab. &lt;/li&gt;
&lt;li&gt;Once the SMTP connection is established, navigate to the ‘Email Test’ tab, enter your email address, toggle the HTML switch on or off, and press ‘Send’.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4gy9a1g78ex5o6mzttwl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4gy9a1g78ex5o6mzttwl.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Within minutes, you can find the email in your Mailtrap inbox to analyze HTML errors, check spam scores, review blacklist status, and more.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frntgldcp2cuwphjhrx9c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frntgldcp2cuwphjhrx9c.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mailtrap.io/register/signup" rel="noopener noreferrer"&gt;Test Emails with Mailtrap for Free&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  API
&lt;/h3&gt;

&lt;p&gt;To integrate Mailtrap Email Testing via API with the WP Mail SMTP plugin, you’ll need to use PHPMailer in your WordPress environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WordPress already includes PHPMailer, so you don’t need to install it separately.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the ‘My Inbox’ page, scroll down to the ‘Integrations’ drop-down menu, select PHPMailer, and copy the code that will appear.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbr8e8isc8b0ij7khjlvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbr8e8isc8b0ij7khjlvf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, customize how the WP Mail SMTP plugin sends emails by adding the code to your theme’s &lt;em&gt;functions.php&lt;/em&gt; file.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add_action( 'phpmailer_init', 'custom_phpmailer_init' );
function custom_phpmailer_init( PHPMailer $phpmailer ) {
    $phpmailer-&amp;gt;isSMTP();     // Set mailer to use SMTP
    $phpmailer-&amp;gt;Host = 'sandbox.smtp.mailtrap.io';  // Specify Mailtrap server
    $phpmailer-&amp;gt;SMTPAuth = true;                    // Enable SMTP authentication
    $phpmailer-&amp;gt;Port = 2525;                        // SMTP port
    $phpmailer-&amp;gt;Username = 'your Mailtrap username';    // Your Mailtrap username
    $phpmailer-&amp;gt;Password = 'your Mailtrap password';    // Your Mailtrap password
    $phpmailer-&amp;gt;SMTPSecure = 'tls';                 // Encryption to use - 'ssl' or 'tls'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;After you’ve made these changes, just like with SMPT, use the ‘Email Test’ tab in the WP Mail SMTP settings to send a test email.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Whether previewing basic WooCommerce email templates directly in the eCommerce platform or leveraging add-ons and advanced email testing tools, the goals remain the same: ensuring your emails look great, achieve optimal deliverability, and perform well across all of the different platforms and devices.&lt;/p&gt;

&lt;p&gt;Check out the tutorials below for more help and a deeper understanding of email management. They’re designed to boost your knowledge and skills, making them a great starting point for anyone eager to master WooCommerce test email techniques. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/woocommerce-send-email/" rel="noopener noreferrer"&gt;Sending Transactional Emails from WooCommerce in 2023&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/wordpress-smtp-settings/" rel="noopener noreferrer"&gt;Configure WordPress SMTP Settings to Send Emails [2023]&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/wordpress-gmail-smtp/" rel="noopener noreferrer"&gt;Sending Emails with WordPress Gmail SMTP [2023]&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/wordpress-send-email/" rel="noopener noreferrer"&gt;Send emails in WordPress: The Definitive Guide [2023]&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/wordpress-transactional-emails/" rel="noopener noreferrer"&gt;Transactional Emails in WordPress: Top 7 Plugins for 2021 | Mailtrap Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We appreciate you chose this article to know &lt;a href="https://mailtrap.io/blog/woocommerce-test-email/" rel="noopener noreferrer"&gt;how to send WooCommerce emails&lt;/a&gt; with Mailtrap. Read more interesting articles on related topics on Mailtrap blog!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Complete Tutorial on Mailto Links: What They Are &amp; How to Use Them</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Wed, 11 Sep 2024 10:28:01 +0000</pubDate>
      <link>https://dev.to/idjuric660/complete-tutorial-on-mailto-links-what-they-are-how-to-use-them-3283</link>
      <guid>https://dev.to/idjuric660/complete-tutorial-on-mailto-links-what-they-are-how-to-use-them-3283</guid>
      <description>&lt;p&gt;HTML is nearly as old as the internet, and so is one of its most common schemes: mailto. And, even though so many things have changed since then, good ol’ mailto is still widely used and taught in HTML courses all around the world.&lt;/p&gt;

&lt;p&gt;The way it works is very simple. When placed behind a text and clicked/tapped afterward, it triggers a default email client to be opened and a new email message creator pops up on a screen. Usually, one or more fields are already pre-populated to make life easier for a sender (and make typos, and subsequent &lt;a href="https://mailtrap.io/blog/soft-vs-hard-bounce/" rel="noopener noreferrer"&gt;email bounces&lt;/a&gt;, impossible).&lt;/p&gt;

&lt;p&gt;We’re going to explore different methods of customizing  html mailto links. We’ll also talk about whether it’s still a good approach in the 2020s, and whether there are any viable alternatives. Let’s start!&lt;/p&gt;

&lt;h2&gt;
  
  
  The basics of mailto
&lt;/h2&gt;

&lt;p&gt;Mailto is a link so you need to use the &lt;a&gt; tag with its href attribute. A very basic mailto syntax that sends an email after clicking/tapping on “I want free Bitcoins” looks like this:&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:piotr@mailtrap.io”&amp;gt;I want free Bitcoins&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;They say the more people you email, the higher the chance of getting what you want, right? If that’s what you really want, you can let your leads contact a few people at once. Simply insert their addresses separated with commas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:piotr@mailtrap.io, john@mailtrap.io, kate@mailtrap.io”&amp;gt;I want free Bitcoins&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clicking on such a link will open the default email app or load a web client in the same or a new tab. What exactly happens depends on the default settings of the recipient’s device and browser (more on that later).&lt;/p&gt;

&lt;p&gt;If the recipient is logged in to their mail client, an empty new message window will pop up with the pre-filled “To:” field. Here’s a Gmail example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fddvciawg12ctdp018mpr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fddvciawg12ctdp018mpr.png" alt="Image description" width="800" height="744"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Customizing further
&lt;/h2&gt;

&lt;p&gt;Okay, that was easy to set up. But the email above is still quite empty and it will take some effort from a customer to populate and send it. Chances are, they’ll change their mind in the process and you really want to give away all those bitcoins you were diligently digging. Luckily, pre-filling a “To:’ field is just the start.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subject line
&lt;/h3&gt;

&lt;p&gt;To automatically add a text in the subject field, insert it after the ‘subject’ parameter, as in the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:piotr@mailtrap.io,john@mailtrap.io,kate@mailtrap.io?subject=Give%20me%20all%20your%20bitcoins”&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;﻿&lt;br&gt;
If this was the first parameter you added to an email address, use “?” to separate them. For any further parameters, you’ll use ampersand “&amp;amp;” instead. To separate words, use the ‘%20’ tag.&lt;/p&gt;
&lt;h3&gt;
  
  
  Email body
&lt;/h3&gt;

&lt;p&gt;Chances are you want to pre-populate the email body as well. For that, you’ll use the ‘body’ parameter (surprise surprise).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:piotr@mailtrap.io,john@mailtrap.io,kate@mailtrap.io?subject=Give%20me%20all%20your%20bitcoins&amp;amp;body=Here%20are%20my%20parents'%20credit%20card%20numbers%3A%0D%0A%0D%0ACheers%2C%0D%0AHappy%20Customer”&amp;gt;I want free Bitcoins&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looks a bit ugly already as, on top of ‘%20’ for separating words, you may also need to separate lines. Use the ‘%0D%0A’ tag for this purpose. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9t60v9riu5zy9uqk15y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9t60v9riu5zy9uqk15y.png" alt="Image description" width="800" height="750"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now this looks a lot better (depending on who you ask, of course).&lt;/p&gt;

&lt;h3&gt;
  
  
  CC and BCC
&lt;/h3&gt;

&lt;p&gt;If for any noble reason, you just want to keep Kate and John in the loop, you can easily &lt;strong&gt;cc and bcc&lt;/strong&gt; (blind carbon copy) &lt;strong&gt;them&lt;/strong&gt;. For example like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:piotr@mailtrap.io? cc=john@mailtrap.io&amp;amp; bcc=kate@mailtrap.io&amp;amp; subject=Give%20me%20all%20your%20bitcoins&amp;amp;body=Here%20are%20my%20parents'%20credit%20card%20numbers%3A%0D%0A%0D%0ACheers%2C%0D%0AHappy%20Customer”&amp;gt;I want free Bitcoins&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Skip the ‘To’ field
&lt;/h3&gt;

&lt;p&gt;Or maybe you don’t really want anyone to email you but instead, you want the folks to spread the news about the giveaway you’re doing? You can omit the ‘To’ field with the following construction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:?subject=Folks%2C%20check%20this%20out!&amp;amp;body=These%20losers%20are%20giving%20away%20bitcoins!”&amp;gt;Spread the news&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Open in a new tab
&lt;/h3&gt;

&lt;p&gt;The last thing that may be useful to know is related to &lt;strong&gt;opening a link containing mailto in a new tab&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href=”mailto:piotr@mailtrap.io” target=”_blank” rel=noopener noreferrer””&amp;gt;I want free Bitcoins&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you use this construction and your clients have a native app set up as a default email client (for example, Microsoft Outlook or Apple Mail), nothing will change. The app will open with a pre-filled email whether you include a ‘target’ parameter or not.&lt;/p&gt;

&lt;p&gt;If, however, they have a web-based client such as Gmail as a default email client, it will make a difference. Using target=”_blank” parameter will cause the email client to open in a new tab, letting a user stay on your website and browse more of your “great” offers. In any other case (also when no target is specified), an email client will load in the same tab.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add an attachment
&lt;/h3&gt;

&lt;p&gt;And what if you wanted to automatically add an attachment? It’s not that simple and for a reason – automatically fetching files from a user’s hard drive and sending them in an email would lead to some serious abuse. For that reason, there’s no parameter related to attachments in the mailto protocol.&lt;/p&gt;

&lt;p&gt;There can be legitimate use cases for attachments, though. &lt;/p&gt;

&lt;p&gt;For example, your site is generating a file (say, a simple design) that users may want to send to a friend right away. To enable this, have a server generate a URL to a file and include it in the body of an email for a recipient to download. The same way, if users are to upload a file, generate a link to it when an upload is finished and include it as a hyperlink in email’s body text.&lt;/p&gt;

&lt;p&gt;Either way, it’s going to be a download link, not an attachment that’s sent. But it should do the job in nearly any situation.&lt;/p&gt;

&lt;h3&gt;
  
  
  You don’t have to do all of this manually
&lt;/h3&gt;

&lt;p&gt;And some good news to wrap up this chapter – there are lots of great tools that will craft a mailto link for you so you don’t need to play with the %20 and %0D%0A tags all day long. Some examples include &lt;a href="https://mailtolink.me/" rel="noopener noreferrer"&gt;https://mailtolink.me/&lt;/a&gt; and &lt;a href="https://htmlstrip.com/mailto-generator" rel="noopener noreferrer"&gt;https://htmlstrip.com/mailto-generator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you need to make sure that all of your mailto links are inserted properly, other links are sent to the right recipients, and that the HTML is not broken in any way, then check out &lt;a href="https://mailtrap.io/" rel="noopener noreferrer"&gt;Mailtrap Email Testing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Email Testing catches your SMTP traffic in a safe environment and let’s you inspect and debug emails in staging, development, and QA stages without spamming recipients. Check the support for a template’s HTML and CSS with the most popular mailbox providers. Analyze emails’ Spam Scores and see if your IP appears in any blacklist reports. Then, automate testing flows with Mailtrap’s Email Testing API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy4qp7eme9c4ja93xeni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy4qp7eme9c4ja93xeni.png" alt="Image description" width="800" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feicd9hlv5naox9drg7vx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feicd9hlv5naox9drg7vx.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xqq9k92dj3iovi83we7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xqq9k92dj3iovi83we7.png" alt="Image description" width="800" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mailtrap.io/register/signup" rel="noopener noreferrer"&gt;Try Mailtrap for Free&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why mailto may not work
&lt;/h2&gt;

&lt;p&gt;As you can see, setting up a mailto is one of the easiest things in HTML. But no matter how hard you try, many of your visitors still won’t take advantage of it.&lt;/p&gt;

&lt;p&gt;Most commonly, their &lt;strong&gt;default email client won’t correspond to the actual client they use to send emails&lt;/strong&gt;. For example, they send with Gmail and Outlook or Apple Mail is set as a default client. (Or the other way around).&lt;/p&gt;

&lt;p&gt;If that’s the case, a client they don’t normally use (and are likely not even logged in to) will load when clicking a mailto link. Needless to say, it’s more likely to annoy them rather than help them reach you.&lt;/p&gt;

&lt;p&gt;They could technically right-click on a mailto link text and copy the mail address to a clipboard for later use:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2c4pmh30oshsaq1lbkc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2c4pmh30oshsaq1lbkc.png" alt="Image description" width="554" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But let’s face it, how many will?&lt;/p&gt;

&lt;h2&gt;
  
  
  Is mailto the right approach?
&lt;/h2&gt;

&lt;p&gt;Mailto links, and email addresses hidden behind them, are also &lt;strong&gt;very easy to harvest&lt;/strong&gt;. Endless amounts of bots crawl websites day and night and they add to their long lists whatever even resembles an email address. Since a mailto link is directly encoded into a web page, they can collect an email behind it within milliseconds. &lt;/p&gt;

&lt;p&gt;This can lead to obvious abuse, usually in the form of an endless wave of unwanted messages in your inbox. You could try to obfuscate the address with JavaScript or other methods to hinder the harvest. But, with already excellent spam filters put in place by reputable email clients, it may not be worth the effort. We discuss it in more detail in our article on &lt;a href="https://mailtrap.io/blog/email-obfuscation/" rel="noopener noreferrer"&gt;email obfuscation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;By putting a mailto link out there, you also share your contact details with any legitimate outreach specialists that wish to reach you. Finding all your company emails hidden in the html code is as easy as a single tap on a &lt;a href="https://hunter.io/" rel="noopener noreferrer"&gt;hunter.io&lt;/a&gt; widget (many similar tools are also available).&lt;/p&gt;

&lt;h3&gt;
  
  
  Is there an alternative?
&lt;/h3&gt;

&lt;p&gt;A contact form is. It’s easy to reach you this way (as long as you don’t add 38 required fields). Your email address is not revealed and, as such, is impossible to harvest. You can gather more specific data this way, forcing users to choose items from a list, as in the example below.&lt;/p&gt;

&lt;p&gt;There are also many free and paid resources online for building beautiful contact forms. And, of course, with a bit of design effort you can build your own forms that perfectly complement your website design.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2fqkf3h6bbt35e68qhg5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2fqkf3h6bbt35e68qhg5.png" alt="Image description" width="768" height="721"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the downside, a contact form may not be the preferred contact method for some of your clients, used to sending emails back and forth. While bots won’t be able to harvest any email this way, they could still populate the fields of a form and hit the ‘send’ button. So if a form is your preferred choice, make sure a &lt;a href="https://www.google.com/recaptcha/intro/v3.html" rel="noopener noreferrer"&gt;latest reCaptcha&lt;/a&gt; is in place to quickly filter out these awkward guests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing the default mailto behavior
&lt;/h2&gt;

&lt;p&gt;If mailto links don’t open for you the way they should, a quick look at the system or browser settings should do the job.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Windows&lt;/strong&gt;, head to Settings -&amp;gt; Apps -&amp;gt; Default apps. Scroll down and pick “Choose default apps by protocol” from the menu. For ‘Mailto’, choose the client of your choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fike2oekbydb44c3fo4dt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fike2oekbydb44c3fo4dt.png" alt="Image description" width="768" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;MacOS&lt;/strong&gt;, open the default Mail app. Log in to your email account (it’s a required step to edit settings). Choose “Mail” from the menu and then “Preferences”. Change the default client in the first dropdown list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fty9hrygd5eou0gqebvx2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fty9hrygd5eou0gqebvx2.png" alt="Image description" width="800" height="785"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want Chrome and Gmail to open mailto links for you by default, make sure Google Chrome is picked as the default client on either OS.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Firefox&lt;/strong&gt;, you can also specify which client should handle mailto links. &lt;/p&gt;

&lt;p&gt;Click on the menu button -&amp;gt; Preferences. Then in ‘General’ go to the ‘Applications’ section and search for ‘Content Type ‘mailto’’. In the action field, pick the desired client:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9teck18b7x3tfh1y6uz1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9teck18b7x3tfh1y6uz1.png" alt="Image description" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;Gmail&lt;/strong&gt; is your client of choice and setting it as default doesn’t fix the problem, there’s one more thing you can do. Launch Chrome and type in chrome://settings/handlers into the address field. You should make sure that mail.google.com is added as a default handler, like in the picture below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1xuu50cjzhluzjy6o18.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1xuu50cjzhluzjy6o18.png" alt="Image description" width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If it’s not, make sure “Allow sites…” is enabled and open your Gmail account. You’ll see a popup asking whether Gmail can open these html email link. Grant the permission and it should fix the problem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftrpfjld84xcvcf0qjfit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftrpfjld84xcvcf0qjfit.png" alt="Image description" width="630" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;By now, you should have a pretty good idea of how to customize and use mailto link, and whether you actually want to use it. Explore our blog, where we cover various topics related to emails – important infrastructure choices, software worth using, email configuration for many different frameworks and libraries. And a lot more!&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to know how to &lt;a href="https://mailtrap.io/blog/mailto-links-explained/" rel="noopener noreferrer"&gt;link an email in HTML&lt;/a&gt;. To discover more interesting topics, read other articles on Mailtrap blog!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Broadcast Emails Explained: When and How to Send Them Effectively</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Fri, 06 Sep 2024 10:25:42 +0000</pubDate>
      <link>https://dev.to/idjuric660/broadcast-emails-explained-when-and-how-to-send-them-effectively-1502</link>
      <guid>https://dev.to/idjuric660/broadcast-emails-explained-when-and-how-to-send-them-effectively-1502</guid>
      <description>&lt;p&gt;Sending the same letter to a large group of people is definitely cost-efficient, but is it effective? In this post, I explain what broadcast emails are, why marketers use them, and how you can send such letters to your audience.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a broadcast email?
&lt;/h2&gt;

&lt;p&gt;Broadcast email is a single message sent to multiple subscribers. These can be email newsletters, promotions, special deals, etc. Broadcast emails are also referred to as &lt;a href="https://mailtrap.io/blog/bulk-email/" rel="noopener noreferrer"&gt;bulk email or mass email&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Unlike spam, broadcast messages are sent on consent and are typically very effective as they are personalized (arrow 1 on the image above) and offer curated content (arrow 2 on the image above). &lt;/p&gt;

&lt;p&gt;The use of broadcast emails is also known as broadcast email marketing and means the same as bulk email marketing or &lt;a href="https://mailtrap.io/blog/mass-email-marketing/" rel="noopener noreferrer"&gt;mass email marketing&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Difference between broadcast email and autoresponder
&lt;/h3&gt;

&lt;p&gt;While broadcast emails are sent to a broad audience all at once, email autoresponders are personalized responses sent to one person in reply to a specific event or action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5pwdhw3kobhh9w3m5fk1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5pwdhw3kobhh9w3m5fk1.png" alt="Image description" width="800" height="859"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Marketers use bulk or broadcast emails as a tool for mass communication, typically scheduled or sent as needed. A sender manually creates an email message and schedules the email blast, personalizing content to meet the audience’s needs at that moment. Broadcast emails aim to inform subscribers, promote deals, and drive conversions, making them a key part of marketing emails.&lt;/p&gt;

&lt;p&gt;In contrast, autoresponders (also known as user-triggered or transactional emails) are automated, triggered emails sent by an app or a website. Users get such emails after a specific action or event, such as signing up for a newsletter, making a purchase, returning a product, or completing a form. Autoresponders are typically based on standard templates. Their main goal is to nurture leads, guide users through a sales funnel, or maintain ongoing engagement with the audience. &lt;/p&gt;

&lt;p&gt;Here are the main differences between broadcast emails and autoresponders:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fteszh1dxi1ttz9gg7vg4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fteszh1dxi1ttz9gg7vg4.png" alt="Image description" width="800" height="687"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples of broadcast emails
&lt;/h2&gt;

&lt;p&gt;Businesses across various industries worldwide use bulk emails to communicate with their audiences. We get dozens of them every day. Here are some broadcast email examples from my Inbox.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sephora deals
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75qvbx6oqomfwyy4zykk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75qvbx6oqomfwyy4zykk.png" alt="Image description" width="800" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every other week, Sephora, a famous luxury cosmetics retailer, sends mass emails about current discounts and deals to its subscribers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Audible 2-for-1 sale
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m235sc4vzazpy6rjemo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m235sc4vzazpy6rjemo.png" alt="Image description" width="800" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Audible is a popular subscription-based audiobook service owned by Amazon. Users pay a monthly subscription fee that provides them with one credit, typically used to purchase one audiobook. Occasionally, the service offers sales where users can get two books for one credit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Grammarly policy update
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4qrlwk555bps2l9y5xhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4qrlwk555bps2l9y5xhk.png" alt="Image description" width="800" height="768"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Grammarly is a digital writing assistant that helps users improve their writing. It operates on a subscription basis and requires users to create personal accounts. Grammarly stores users’ data and follows strict privacy policies to keep this information safe. The service informs users of any updates and changes whenever they occur.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lisa Eldridge – new product release
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vkxlmx5smneuezs9w9z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vkxlmx5smneuezs9w9z.png" alt="Image description" width="800" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lisa Eldridge, a famous makeup artist, launched her own lipstick line in 2018. Since then, she has expanded the range of products, announcing these updates via email to her wide fan base.&lt;/p&gt;

&lt;h2&gt;
  
  
  7 Types and use cases of broadcast emails
&lt;/h2&gt;

&lt;p&gt;Broadcast emails serve various purposes and come in different forms. There is no strict classification for these emails since each type is designed to meet specific marketing objectives. They can accomplish various tasks, and new use cases are constantly emerging. &lt;/p&gt;

&lt;p&gt;In this post, I have categorized broadcast emails into seven types. However, there may see them overlapping or a need to further divide certain types, as they may appear similar but serve different purposes. &lt;/p&gt;

&lt;h3&gt;
  
  
  Newsletters
&lt;/h3&gt;

&lt;p&gt;Businesses send email newsletters to keep subscribers informed about company updates, industry news, and valuable content. These emails may include blog posts, info on upcoming events, product launches, and exclusive offers. &lt;/p&gt;

&lt;p&gt;Businesses send newsletters regularly, every week, month, or quarter, to maintain consistent communication with their audience. &lt;/p&gt;

&lt;p&gt;The rule of thumb here is to personalize and tailor the newsletter content to drive traffic to their websites, increase brand loyalty, and encourage repeat deals.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73equrva2dgt0tueei4f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73equrva2dgt0tueei4f.png" alt="Image description" width="800" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Promotional emails
&lt;/h3&gt;

&lt;p&gt;Companies send promotional email messages to bring attention to their special offers, discounts, and exclusive deals. &lt;/p&gt;

&lt;p&gt;These emails are designed to create a sense of urgency (with all these “Only today” and “2 pairs left in stock”), encouraging recipients to act quickly. Promotional emails often include eye-catching visuals, compelling call-to-action buttons, and personalized recommendations to enhance their appeal and effectiveness.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd24gf8gpyjn1ot89tovd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd24gf8gpyjn1ot89tovd.png" alt="Image description" width="800" height="853"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Invitations
&lt;/h3&gt;

&lt;p&gt;Businesses use emails to inform and invite subscribers to webinars, conferences, local gatherings, or other online or offline events.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcqx9hsfcy2ef3xw1xa9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcqx9hsfcy2ef3xw1xa9.png" alt="Image description" width="800" height="1020"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Such emails often include details about the event, such as the date, time, location, and agenda of the meeting, speakers, or special activities. Also, they highlight the benefits a person can get from participating in an event. &lt;/p&gt;

&lt;h3&gt;
  
  
  Product announcements
&lt;/h3&gt;

&lt;p&gt;Product announcement emails are used to inform subscribers and customers about new product launches, feature releases, or updates. Businesses send such emails to generate excitement and raise awareness about the latest offerings from a company.&lt;/p&gt;

&lt;p&gt;In a product announcement email, companies often highlight the benefits and unique selling points of the new product or feature. They also explain how a new feature or update can solve a problem or offer something new and innovative. This information helps potential customers understand the value of the new/updated product and drives them to take action, such as purchasing something or visiting the company’s website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fak0s6zvarfvdf587dxa9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fak0s6zvarfvdf587dxa9.png" alt="Image description" width="800" height="1077"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Surveys and feedback requests
&lt;/h3&gt;

&lt;p&gt;Companies often gather customer feedback and opinions on their products, services, and overall experiences. This way they can make informed improvements to their offerings. &lt;/p&gt;

&lt;p&gt;The most common surveys companies launch include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Customer satisfaction surveys&lt;/strong&gt; to measure how satisfied customers are with a product, service, or experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Product feedback surveys&lt;/strong&gt; to gather detailed opinions about a specific product, its functionality, and design.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service feedback surveys&lt;/strong&gt; to focus on the quality of customer service interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Market research surveys&lt;/strong&gt; to understand broader market trends and customer preferences.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please note that surveys might also be sent as autoresponder emails after a product return or a product delivery, like this email from the FortunateOne brand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd4mf1uoax0a8xzfn2im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd4mf1uoax0a8xzfn2im.png" alt="Image description" width="800" height="794"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Content distribution
&lt;/h3&gt;

&lt;p&gt;Content distribution emails aim to educate and engage the audience by sharing valuable content such as blog posts, whitepapers, and case studies.&lt;/p&gt;

&lt;p&gt;These emails help position companies as industry leaders by providing relevant and high-quality information. For example, a tech company might send an email featuring its latest blog post on AI trends, a whitepaper on cybersecurity best practices, or a case study showcasing a successful client project. &lt;/p&gt;

&lt;p&gt;By regularly sharing valuable content, businesses can build trust and non-intrusively remind clients about themselves.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8wj3crmjpna4agcavjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8wj3crmjpna4agcavjl.png" alt="Image description" width="800" height="808"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Seasonal greetings and holiday emails
&lt;/h3&gt;

&lt;p&gt;Retailers love these mass emails and never miss a chance to greet their customers and offer a sale (yes, I’m talking about Christmas offers and Black Friday madness).&lt;/p&gt;

&lt;p&gt;Such emails help sell more and enhance brand visibility, especially if it’s a personalized greeting rather than just an upsell offer. By acknowledging significant holidays, brands create a sense of connection and goodwill.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5eqivub7pwympaf5wv35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5eqivub7pwympaf5wv35.png" alt="Image description" width="800" height="963"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the benefits and drawbacks of broadcast emails?
&lt;/h2&gt;

&lt;p&gt;Now the juiciest part. Are broadcast/bulk emails so efficient (given their cost effectiveness) as they say, or is it a myth?  Let’s take a look at the honest review of bulk email benefits and drawbacks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of broadcast emails
&lt;/h3&gt;

&lt;p&gt;Mass emails offer several significant advantages for businesses that can make you want to use the technology for your business:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost-effectiveness&lt;/strong&gt; is one of the biggest advantages, especially when compared to traditional print or TV advertising. The main expenses include email marketing software like email-sending platform subscription and content creation. Many platforms offer &lt;a href="https://help.mailtrap.io/article/105-email-templates" rel="noopener noreferrer"&gt;email templates&lt;/a&gt; to simplify and speed up the content creation process. Also, they may offer list management, marketing automation, testing, and analytics tools, which further reduce the cost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wide reach&lt;/strong&gt;. Mass emails are an excellent tool for announcements, promotions and updates, or any other information that you would like to convey to a large number of your subscribers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measurable results&lt;/strong&gt;. Email Delivery Platforms like Mailtrap provide detailed analytics on open, click rates and conversions. This data can help you understand the effectiveness of your broadcast campaigns and make data-driven decisions on your email marketing strategy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immediate impact&lt;/strong&gt;. Bulk emails can deliver information instantly, making them ideal for time-sensitive announcements, such as flash sales or urgent updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved customer relationships&lt;/strong&gt;. Regularly sending informative and valuable content helps maintain consistent communication with customers, creating loyalty and trust.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customizable content&lt;/strong&gt;. You can tailor the content of mass emails to suit different segments of your audience. This way, you can ensure the information is relevant and engaging for each group of recipients.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automation&lt;/strong&gt;. Many email marketing tools offer automation features to schedule email sending in advance. By sending relevant emails regularly at the most suitable time for recipients, you can create stronger bonds with your audience and build a loyal community for your brand.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Drawbacks of broadcast emails
&lt;/h3&gt;

&lt;p&gt;If you’ve ever clicked on a link in an email offering special deals and ended up making a purchase, you understand the power of mass emails. However, they only work when done correctly. Otherwise, broadcast emails might damage your relationship with subscribers and hurt your business. Here’s how:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Risk of being marked as spam&lt;/strong&gt;. If you send emails too frequently or without sufficient relevance, subscribers can perceive them as spam. When many recipients unsubscribe it damages your sender’s reputation and reduces email deliverability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limited personalization&lt;/strong&gt;. Mass emails can be personalized to some extent, yet, they often lack the deep personalization that more targeted email campaigns can offer. As a result, you get lower engagement rates compared to emails that are highly tailored to individual recipient preferences and behaviors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broad content&lt;/strong&gt;. Due to their broad audience, mass emails tend to have more general content, which may not be as compelling or relevant to all recipients. This is why emails usually have lower open and click-through rates. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deliverability issues&lt;/strong&gt;. Mindless dispatches of broadcasting emails to a large audience simultaneously can trigger spam filters. If this happens, your emails will end up in the Spam folder. In the future, this will reduce your email deliverability, making it harder to reach your audience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Over-reliance on automation&lt;/strong&gt;. While automation can streamline the process, it can also lead to a “set and forget” mentality, where emails are sent without strict supervision, continuous optimization, and improvement based on performance data and feedback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource intensive&lt;/strong&gt;. Yes, broadcast messages cost less than some other marketing approaches yet they are labor and time-consuming at the preparatory stage. Developing a strategy, planning content creation well in advance, and designing compelling messages demand time and effort. Additionally, ongoing tasks such as segmenting the email list, performing A/B testing, and analyzing campaign performance to optimize future emails can further add to the workload. This resource-intensive process is essential for an effective and successful broadcast campaign.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Email broadcasting tools
&lt;/h2&gt;

&lt;p&gt;There are many &lt;a href="https://mailtrap.io/blog/mass-email-service-providers/" rel="noopener noreferrer"&gt;email-sending platforms&lt;/a&gt; out there. To choose the best one for yourself, you need to focus on those providers, who offer email broadcast capabilities. Here’s a comparison of the most popular options:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjekk4p339qkxcan7a85x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjekk4p339qkxcan7a85x.png" alt="Image description" width="800" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;The cost per email is calculated based on the most expensive plan indicated on the service provider’s website. Keep in mind that with lower (cheaper) plans, the cost per email tends to be higher&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;**&lt;em&gt;I used a 5-star grading system, where 5 represents the most user-friendly experience and 0 represents the least user-friendly&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to send broadcast emails?
&lt;/h2&gt;

&lt;p&gt;Of course, I’ll show you how to send broadcast emails with Mailtrap. It’s pretty easy, and the marketing suite is simple to use! The only condition is that you should register and verify your sending domain first. But don’t worry—it won’t take long, and I’m here to walk you through this process! &lt;/p&gt;

&lt;p&gt;With Mailtrap, you can quickly set everything up, create an email using a template or drag-and-drop editor, and send it to your subscribers within minutes. Trust me, it’s that simple!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1. Set up an account in Mailtrap
&lt;/h3&gt;

&lt;p&gt;Start by &lt;a href="https://mailtrap.io/register/signup?ref=header" rel="noopener noreferrer"&gt;signing up for a Mailtrap account&lt;/a&gt; via Google, GitHub, Office 365 account, or your email. Create a password and you are ready to go!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2. Add and verify your sending domain
&lt;/h3&gt;

&lt;p&gt;Set up the sending infrastructure by adding and verifying the domain you own. &lt;/p&gt;

&lt;p&gt;First, add your domain or subdomain, you want to use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptspq78i771ia3nkqlrt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptspq78i771ia3nkqlrt.png" alt="Image description" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, add the DNS records provided by Mailtrap. Log in to your domain provider account, select the necessary domain and find the DNS record information. If your domain is hosted on GoDaddy, open the chosen domain in your account, go to the “Additional Setting”’ tab, and click the “Manage DNS” button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuflbstltppg525gaegw3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuflbstltppg525gaegw3.png" alt="Image description" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the DNS records provided by Mailtrap and hit the “Verify all” button.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3. Create a marketing campaign
&lt;/h3&gt;

&lt;p&gt;Open the “Email Marketing” tap and click the “Open new campaign” button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faeesl79k3h6isk6sblc8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faeesl79k3h6isk6sblc8.png" alt="Image description" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill in all the necessary fields and hit “Continue”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r56x0i3zl9k3v68c8vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r56x0i3zl9k3v68c8vk.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select an existing template or create one from scratch. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8bkryqs9s9k73s53dcyz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8bkryqs9s9k73s53dcyz.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the content and press the “Send Test” button. In a few seconds, the email will land in the inbox of the email address you used to log in to Mailtrap. Check the content, formatting, and overall appearance to make sure everything looks perfect. &lt;/p&gt;

&lt;p&gt;Like what you see? If so, click the “Continue” button to proceed to importing your subscriber list. &lt;/p&gt;

&lt;p&gt;Most email lists are stored in CSV files. Download the CSV template to ensure your file is correctly formatted, or use this template to complete your user database. Once your list is ready, add it and click “Import recipients.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30posy46glchza3xtk6x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30posy46glchza3xtk6x.png" alt="Image description" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Review your CSV mapping and select the variables that will appear in each email. Once everything is set, confirm the mapping.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgglrxu9fmp0bdf7w7t2a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgglrxu9fmp0bdf7w7t2a.png" alt="Image description" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The import is complete. If any errors occur, you’ll see failed imports listed. You can go back to the mapping step to identify and fix the issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk10x8w3ofpgx3m9a6s20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk10x8w3ofpgx3m9a6s20.png" alt="Image description" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit the “Finish” button. Now you see all the data of your broadcast email campaign. From here, you can choose to send another test email, send an email now, or schedule it for later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnxk1urt2o4c09yaemaru.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnxk1urt2o4c09yaemaru.png" alt="Image description" width="800" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While scheduling, please note that the time zone is set to UTC&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2w7to9roupi09ybtsin.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2w7to9roupi09ybtsin.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Confirm the sending and wait for emails to be dispatched. In the set date and time, your recipients will get your emails.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fspel3s2te299wvs9bybc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fspel3s2te299wvs9bybc.png" alt="Image description" width="800" height="998"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://mailtrap.io/email-marketing/" rel="noopener noreferrer"&gt;Send your First Marketing Campaign with Mailtrap&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Email broadcasting best practices
&lt;/h2&gt;

&lt;p&gt;Mass emailing can be very effective for your business if you follow industry best practices. Here are the main ones to always keep in mind.&lt;/p&gt;

&lt;h3&gt;
  
  
  Segment the audience
&lt;/h3&gt;

&lt;p&gt;Unless you run a very specific, niche business in one particular location, it’s better to segment your subscribers. Divide your contact list into groups based on demographics, behavior, or interests to send more relevant content.&lt;/p&gt;

&lt;h3&gt;
  
  
  Personalize emails
&lt;/h3&gt;

&lt;p&gt;The least that you can do is to refer to a subscriber by name in every email. However, you can go further and pick the content based on their past interactions, preferences, and behavior.&lt;/p&gt;

&lt;p&gt;For example, send product recommendations that align with clients’ previous purchases or interests, and use dynamic content to ensure that each recipient sees the most relevant offers. &lt;/p&gt;

&lt;h3&gt;
  
  
  Keep it short and focused
&lt;/h3&gt;

&lt;p&gt;If your store receives new products, highlight 5-7 in a newsletter rather than overwhelming subscribers with the entire collection. The same goes for news, updates, and events. Show some diversity, but avoid bombarding users with too much information at once. &lt;/p&gt;

&lt;h3&gt;
  
  
  Be consistent
&lt;/h3&gt;

&lt;p&gt;Bulk emails are the most effective when sent regularly and at the right time. Start with a thorough content plan that includes your goals, frequency of communication, and content types you’ll be using.&lt;/p&gt;

&lt;p&gt;Spend some time analyzing when your audience is most likely to open and read your emails. It might take a bit of experimenting, but once you nail it down, you’ll see better engagement and results.&lt;/p&gt;

&lt;p&gt;Consistency is also crucial for your sender’s reputation. Internet and email providers monitor your sending habits to detect spam. Irregular or sporadic email activity can raise red flags, potentially harming your deliverability rates. &lt;/p&gt;

&lt;p&gt;By consistently sending well-timed, relevant emails, you build trust not only with your audience but also with email providers, increasing the chances that your emails will land in inboxes rather than the spam folder&lt;/p&gt;

&lt;h3&gt;
  
  
  Add a straightforward call to action
&lt;/h3&gt;

&lt;p&gt;Not every email needs a CTA. But if you want readers to take action, make it sound short, straightforward, and beneficial.&lt;/p&gt;

&lt;h3&gt;
  
  
  A/B Testing
&lt;/h3&gt;

&lt;p&gt;A/B testing is the holy grail for all sorts of emails you plan to send. By experimenting with subject lines, images, fonts, and even tone of voice, you can identify what resonates best with your audience and significantly improve your email performance. &lt;/p&gt;

&lt;h3&gt;
  
  
  Schedule regular email marketing audit
&lt;/h3&gt;

&lt;p&gt;By regularly reviewing your email campaigns, you can analyze the number of customers who open your emails, track your expenses, and pinpoint what is not performing as expected. This process also assists in identifying areas where resources may be wasted. With these insights, you can develop more robust and efficient email campaigns in the future.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/U0cMhNhwSac"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this post, I have covered the most common questions marketers have about email broadcasting. If you plan to closely work with emails in your application, then you might also need to check out the following blog posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/smtp-providers/" rel="noopener noreferrer"&gt;SMTP Providers Compared: Choose the Best One for Sending Transactional and Marketing Emails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/email-marketing-for-apps/" rel="noopener noreferrer"&gt;Email Marketing for Apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/affiliate-marketing-email-templates/" rel="noopener noreferrer"&gt;5 Affiliate Marketing Email Templates to Use in 2024&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/email-marketing-ideas/" rel="noopener noreferrer"&gt;Email Marketing Ideas&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Article by&lt;br&gt;
&lt;strong&gt;Daria Roshchyna&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to know &lt;a href="https://mailtrap.io/blog/broadcast-email/" rel="noopener noreferrer"&gt;how to send a broadcast email&lt;/a&gt;. &lt;a href="https://mailtrap.io/blog/broadcast-email/" rel="noopener noreferrer"&gt;Click here&lt;/a&gt; to find more interesting articles! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Ins and Outs of POP 3 (Post Office Protocol 3)</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Wed, 21 Aug 2024 13:33:12 +0000</pubDate>
      <link>https://dev.to/idjuric660/the-ins-and-outs-of-pop-3-post-office-protocol-3-3mng</link>
      <guid>https://dev.to/idjuric660/the-ins-and-outs-of-pop-3-post-office-protocol-3-3mng</guid>
      <description>&lt;p&gt;Navigating emails can be like driving a car – most of us know how to drive one, but not everyone understands what’s under the hood.&lt;/p&gt;

&lt;p&gt;If you have ever opened a new email message and wondered what’s behind it, you’ve come to the right place.&lt;/p&gt;

&lt;p&gt;In this article, I’m going to pop open the hood on POP3, one of the mail protocols responsible for retrieving the emails we receive every day. I’ll show you how it works and provide you with a step-by-step tutorial on how to test it out yourself by using some simple POP3 commands.&lt;/p&gt;

&lt;p&gt;Don’t worry – it’s not rocket science. Let’s get straight into it!&lt;/p&gt;

&lt;h2&gt;
  
  
  What is POP3?
&lt;/h2&gt;

&lt;p&gt;POP3, or Post Office Protocol version 3, is an Internet standard protocol that retrieves email messages from a server over a TCP/IP connection. It’s the third version of the Post Office Protocol 3, which is defined in &lt;a href="https://datatracker.ietf.org/doc/html/rfc1939" rel="noopener noreferrer"&gt;RFC 1939&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Unlike Internet Message Access Protocol (IMAP), which stores your emails on the mail server, POP3 downloads them from the server to your device. It’s important to note that both are “email retrieval” or “pull protocols,” meaning they only receive new messages instead of sending them like Simple Mail Transfer Protocol (SMTP).&lt;/p&gt;

&lt;p&gt;Read our article on &lt;a href="https://mailtrap.io/blog/pop3-vs-imap/" rel="noopener noreferrer"&gt;IMAP vs POP3&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;You can also watch our video tutorial to see what makes POP3 different from the IMAP pull protocol.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iBrjBsmyadc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How does POP3 work?
&lt;/h2&gt;

&lt;p&gt;POP3 connection is a 4-step process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The email client connects to the mail server&lt;/li&gt;
&lt;li&gt;The email client downloads new emails to the local device from the mail server&lt;/li&gt;
&lt;li&gt;By default, the mail server deletes the stored messages&lt;/li&gt;
&lt;li&gt;   - Note: The protocol can be configured to temporarily save your emails on the server&lt;/li&gt;
&lt;li&gt;The transmission ends when the client disconnects from the server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5nb5usfrlm8xzctefogt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5nb5usfrlm8xzctefogt.png" alt="Image description" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the easiest ways to understand POP3 is to think of the protocol as the mail clerk. In this analogy, your email would be physical mail, and the email server the post office.&lt;/p&gt;

&lt;p&gt;Now, when you (acting as the email client) go to receive mail from the post office, the clerk (POP3) will give you all the new mail and let you collect (download) it, so you can bring it home (your local computer).&lt;/p&gt;

&lt;p&gt;As it isn’t a common practice, the post office doesn’t make any copies of your mail, so the clerk will no longer have access to it once you’ve picked it up. However, you can ask the clerk to make a copy of your mail and keep it at the post office.&lt;/p&gt;

&lt;h2&gt;
  
  
  What POP3 is used for
&lt;/h2&gt;

&lt;p&gt;Besides its basic functionality to download messages from the email server, POP3 can also be integrated with various APIs for advanced use cases, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Custom API integration&lt;/strong&gt; – If your business needs it, you can develop custom APIs that integrate with POP3 for specialized functions, like triggering actions in internal systems based on email content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics and data processing&lt;/strong&gt; – Once you download your emails via POP3, you can integrate natural language processing (NLP) or text analysis APIs like Google Natural Language or IBM Watson Natural Language Understanding to analyze the content of those emails. This can be super useful for &lt;a href="https://brand24.com/blog/sentiment-analysis/" rel="noopener noreferrer"&gt;sentiment analysis&lt;/a&gt;, keyword extraction, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security and compliance&lt;/strong&gt; – You can use POP3 to download emails and then work with security APIs such as &lt;a href="https://www.virustotal.com/" rel="noopener noreferrer"&gt;VirusTotal&lt;/a&gt; or &lt;a href="https://www.proofpoint.com/us" rel="noopener noreferrer"&gt;Proofpoint&lt;/a&gt; for threat detection, checking for spam, and phishing attempts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pros and Cons of POP3
&lt;/h2&gt;

&lt;p&gt;I had a discussion on the advantages and disadvantages of POP3 with our deliverability specialist, Yaroslav, and here’s his breakdown of the protocol’s pros and cons.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simple-to-use&lt;/strong&gt; – POP3 is a straightforward protocol that focuses on delivering simplicity to the user. Implementing and using it is super easy, which makes it an ideal protocol for applications that require basic email functionalities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced server load&lt;/strong&gt; – As POP3 downloads and deletes emails from the server by default, it keeps the server storage space manageable, which, in turn, reduces load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline access&lt;/strong&gt; – Because new emails are stored on your device, you will be able to manage them without an internet connection. This can be super useful for software that operates offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bandwidth efficiency&lt;/strong&gt; – POP3 minimizes the amount of data transferred between the email client and mail server as you don’t have to be connected to the internet all the time to see your emails. This goes a long way for slow internet connections with limited bandwidth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Legacy system compatibility&lt;/strong&gt; – If you’re working with legacy systems, POP3 is the perfect option for you as it’s compatible with most older systems and can be easily integrated with them. Besides POP3, you can also use &lt;a href="https://brainhub.eu/services/legacy-app-modernization" rel="noopener noreferrer"&gt;legacy app modernization&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supported by numerous email clients&lt;/strong&gt; – As it’s been around for quite a while, many popular mail clients support POP3, such as Gmail, Mozilla Thunderbird, Apple Mail, Microsoft Outlook, and others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cons
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited features&lt;/strong&gt; – Simplicity, the protocol’s biggest advantage, might as well be its biggest disadvantage as it lacks features such as folder management, server-side searching, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk of data loss&lt;/strong&gt; – If you don’t configure your POP3 client to store messages on the server after downloading them, you’re essentially facing the risk of data loss as the local copies might be compromised due to hardware failure or malware attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No synchronization&lt;/strong&gt; – POP3 doesn’t synchronize emails across devices in real-time, which can be a major limitation if you access your emails on different devices. If you can’t live with this, then you might want to check out the two-way IMAP protocol.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No backup solution&lt;/strong&gt; – The protocol doesn’t offer a backup solution, and as it downloads your messages locally, you will have to either configure it to keep your email on the server or back it up another way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limited scalability&lt;/strong&gt; – Because of its limited set of features and server-side capabilities, POP3 isn’t the most optimal protocol for you if you’re building an application that scales with user growth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local storage space consumption&lt;/strong&gt; – Although a benefit of POP3 is that it reduces server load, there’s a downside to it because all of the emails go to your local machine. This can be a huge issue if you’re dealing with large volumes of email or emails with large attachments or if you’re downloading all of your mail on a single device.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  POP3 ports
&lt;/h2&gt;

&lt;p&gt;For connecting to remote servers, the POP3 protocol typically uses two port numbers. Namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Port 110&lt;/strong&gt; – The non-encrypted, default port, typically used by older email clients, internal networks where external access isn’t an issue, or even for troubleshooting purposes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port 995&lt;/strong&gt; – The encrypted, more secure port which supports SSL/TLS connections. It’s used as standard by most webmail providers and preferred by the majority of users due to the security it provides.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  POP3 settings
&lt;/h2&gt;

&lt;p&gt;The most secure way of testing POP3 for yourself is to use OpenSSL, which encrypts your sensitive data. On top of that, I found it easy and efficient.&lt;/p&gt;

&lt;p&gt;Just follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download and install the latest version of OpenSSL&lt;/li&gt;
&lt;li&gt;Enable POP in your email provider settings, as it might be disabled by default&lt;/li&gt;
&lt;li&gt;Open your command line interface&lt;/li&gt;
&lt;li&gt;Connect to a POP3 server with &lt;strong&gt;openssls_client -connect pop.yourmailserver.com:995 -crlf&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Make sure to replace yourmailserver with your provider’s domain name (e.g., &lt;strong&gt;gmail.com&lt;/strong&gt; or &lt;strong&gt;mail.outlook&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;If you use Windows OS, you should omit &lt;strong&gt;-crlf&lt;/strong&gt; as it can lead to an error due to double conversion&lt;/li&gt;
&lt;li&gt;Send the &lt;strong&gt;USER&lt;/strong&gt; and &lt;strong&gt;PASS&lt;/strong&gt; commands with your credentials. For example:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;USER&lt;/strong&gt; yourusername&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PASS&lt;/strong&gt; yourpassword&lt;/li&gt;
&lt;li&gt;Note, that if you have two-factor authentication enabled, you should use your App password to log in (if you’re a Gmail user, make sure to remove spaces in the 16-digit password)&lt;/li&gt;
&lt;li&gt;List all messages with the &lt;strong&gt;LIST&lt;/strong&gt; command&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;retr&lt;/strong&gt; command followed by the message number to see every &lt;a href="https://mailtrap.io/blog/email-headers/" rel="noopener noreferrer"&gt;message header&lt;/a&gt; and the text. For instance:&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;retr 1&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;If you’re encountering &lt;strong&gt;SSL_renegotiate:wrong ssl version&lt;/strong&gt; error, simply add &lt;strong&gt;-ign_eof&lt;/strong&gt; at the end of the first command: **openssl s_client -connect pop.yourmailserver.com:995 -crlf -ign_eof&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Enter &lt;strong&gt;QUIT&lt;/strong&gt; to finish the session**&lt;/p&gt;

&lt;p&gt;The process should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpg0bsb7ikdjyu728nc46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpg0bsb7ikdjyu728nc46.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Learn more about email protocols
&lt;/h2&gt;

&lt;p&gt;See? Didn’t I tell you it’s not rocket science? We hope we’ve cleared some things up and helped you understand how POP3 works.&lt;/p&gt;

&lt;p&gt;If you’re up for more reads, we recommend you go over our article &lt;a href="https://mailtrap.io/blog/imap-vs-pop3-vs-smtp-email-protocols/" rel="noopener noreferrer"&gt;comparing POP3, IMAP4, and SMTP&lt;/a&gt; and further expand your knowledge about protocols, which are just a part of &lt;a href="https://mailtrap.io/blog/email-infrastructure/" rel="noopener noreferrer"&gt;email infrastructure&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Now, running a local mail server or integrating an email protocol within your app is one thing, but ensuring your emails are delivered is another. That’s why you should check out deliverability services, such as the &lt;a href="https://mailtrap.io/" rel="noopener noreferrer"&gt;Mailtrap email delivery platform&lt;/a&gt;, which combines API and SMTP service to make sure your emails get delivered where they’re supposed to and when they’re supposed to.&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to discover what POP3 protocol is. To find even more useful information, &lt;a href="https://mailtrap.io/blog/pop3/" rel="noopener noreferrer"&gt;click here&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Webhooks Explained</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Thu, 15 Aug 2024 09:34:24 +0000</pubDate>
      <link>https://dev.to/idjuric660/webhooks-explained-4a5h</link>
      <guid>https://dev.to/idjuric660/webhooks-explained-4a5h</guid>
      <description>&lt;p&gt;So, what’s the catch with webhooks?&lt;/p&gt;

&lt;p&gt;Not using them nowadays would be like commuting to work on a horse. Charming? Yes, definitely, but not very efficient I’m afraid.&lt;/p&gt;

&lt;p&gt;In this article, I explain webhooks and provide you with all the technical tidbits you need to know in order to be webhook-fluent.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are webhooks?
&lt;/h2&gt;

&lt;p&gt;Webhooks are user-defined HTTP callback functions that allow two applications to communicate with each other. They operate via the &lt;em&gt;&lt;strong&gt;web&lt;/strong&gt;&lt;/em&gt;, and refer to &lt;em&gt;&lt;strong&gt;hooks&lt;/strong&gt;&lt;/em&gt; in software that trigger actions based on specific events. Hence, the name &lt;em&gt;&lt;strong&gt;webhooks&lt;/strong&gt;&lt;/em&gt;. 🪝&lt;/p&gt;

&lt;p&gt;Put simply, webhooks are automated messages sent from apps when something happens.&lt;/p&gt;

&lt;p&gt;You can think of them as hotel receptionists who, when a new guest arrives (specific event), update the hotel’s records (your app) and check the guests in. Similarly, if a new user registers on your website, a webhook will tell your app, which processes the registration and updates the database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnuj8wtvyyn3tb2w1gov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnuj8wtvyyn3tb2w1gov.png" alt="Image description" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While user registrations are a common trigger, webhooks can be triggered for other events and have more complex use cases, which I delve into a bit &lt;a href="https://mailtrap.io/blog/what-are-webhooks/#What-are-webhooks-used-for" rel="noopener noreferrer"&gt;later in the article&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do webhooks work?
&lt;/h2&gt;

&lt;p&gt;When a specified event triggers your app (e.g., a user registers), the webhook sends an HTTP request, which consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Webhook URL&lt;/strong&gt; – Indicates where you want to send the request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Body (payload)&lt;/strong&gt; – Contains the information you want to send to another app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Header&lt;/strong&gt; – Specifies how the information in the header is formatted (e.g., XML, JSON)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Request method&lt;/strong&gt; – The request can either be GET, POST, PUT, or DELETE&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the app receives the HTTP request from a webhook, it sends a response that lets your trigger app know if the request is completed successfully. Once processed and added to the database, every component of the request will be available on all client connections that may need the data it contains.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9xtipyrhpsbyfglyuk3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9xtipyrhpsbyfglyuk3.png" alt="Image description" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And don’t worry, I’ll also show you how webhooks work in detail via practical examples &lt;a href="https://mailtrap.io/blog/what-are-webhooks/#Examples-of-webhooks" rel="noopener noreferrer"&gt;in a minute&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Webhooks vs API
&lt;/h3&gt;

&lt;p&gt;Both webhooks and APIs (application programming interface) are equally important for communication between software. However, although they are similar in their essence, they work in vastly different ways.&lt;/p&gt;

&lt;p&gt;Consider APIs and webhooks as siblings, and let’s say those siblings are on a road trip, sitting comfortably in the backseat. APIs will constantly ask: “&lt;a href="https://www.youtube.com/watch?v=a8k1eTEw4rQ" rel="noopener noreferrer"&gt;Are we there yet? Are we there yet?.&lt;/a&gt;” In tech terms, this is called &lt;em&gt;&lt;strong&gt;polling&lt;/strong&gt;&lt;/em&gt;, a process that asks another system, or even another API, for an update to see if something has changed.&lt;/p&gt;

&lt;p&gt;A webhook, on the other hand, is the silent type, the kid who tells you: hey, just let me know when we arrive!” and will elegantly leave when the car stops. Again, in tech terms, this is called &lt;em&gt;&lt;strong&gt;pushing&lt;/strong&gt;&lt;/em&gt;, a process that sends, or ‘pushes’ data to a client or server when a specific event occurs. Hence why webhooks are also known as ‘&lt;em&gt;push APIs&lt;/em&gt;’ or ‘&lt;em&gt;reverse APIs&lt;/em&gt;’.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felpdag2m92cub7dwo4uw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felpdag2m92cub7dwo4uw.png" alt="Image description" width="564" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In a nutshell&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;APIs&lt;/em&gt;&lt;/strong&gt; are a set of definitions and protocols that request information through polling, are more complex than webhooks, and are used for purposes such as retrieving data on demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Webhooks&lt;/em&gt;&lt;/strong&gt; are a type of event-driven APIs that send information or perform specific functions in response to triggers (e.g., button clicks, user registrations, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re interested in the more technical side of this comparison, check out the table below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdjplsac8shicxb6ulxwj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdjplsac8shicxb6ulxwj.png" alt="Image description" width="800" height="974"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Webhooks vs WebSockets
&lt;/h3&gt;

&lt;p&gt;As a user from a &lt;a href="https://stackoverflow.com/questions/23172760/differences-between-webhook-and-websocket" rel="noopener noreferrer"&gt;Stack Overflow thread&lt;/a&gt; would put it, &lt;em&gt;webhooks and WebSockets solve different aspects of one problem in very different ways&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;The main difference between the two is that webhooks are event-driven, acting only after a specific trigger. On the other hand, WebSockets keep the connection between two apps (or APIs) open, waiting for something to happen. This allows for real-time communication, updates, and synchronization between both sides of the ‘conversation.’&lt;/p&gt;

&lt;p&gt;For a clearer picture, here’s how WebSockets work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Initiation&lt;/strong&gt; – The client starts a WebSocket connection to the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open connection&lt;/strong&gt; – Once open, the connection stays open.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two-way communication&lt;/strong&gt; – Both the client and the server have the ability to continuously send messages to each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Okay, now it’s time for, you guessed it, another allegory! If webhooks are hotel receptionists who only wait for someone to arrive, we can think of WebSockets as some kind of special (quite inefficient) receptionists who keep the doors open all the time, scouting for guests in front of the hotel, even if it’s a very, very slow night.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgv6oaafxa3v0zzlhr0bu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgv6oaafxa3v0zzlhr0bu.png" alt="Image description" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In a nutshell&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;WebSockets provide&lt;/strong&gt;&lt;/em&gt; a long-lived connection that allows a client and a server to send each other messages at any time. They are ideal for applications that require continuous data flow, such as financial trading platforms, live chats, etc.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;Webhooks&lt;/strong&gt;&lt;/em&gt; don’t keep an open connection and only perform specific functions in response to triggers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And of course, a tech-table for all you lovers of geeky info out there:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj81e2t5w7x022shfkyb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj81e2t5w7x022shfkyb0.png" alt="Image description" width="800" height="1349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are webhooks used for?
&lt;/h2&gt;

&lt;p&gt;Okay, now that you’re familiar with webhooks, it’s time to go over what they’re typically used for, which includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real-time notifications&lt;/strong&gt; – If you’re running an e-commerce platform, you can use webhooks to notify your inventory management system whenever a new order is placed. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data synchronization&lt;/strong&gt; – Have two or more systems in place? No problem, because webhooks can push notifications from one system to the other whenever a change happens (e.g., a user updates their profile).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow automation&lt;/strong&gt; – You can make a webhook trigger to send a notification in Slack whenever a new issue is created in a project management tool (e.g., Jira).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring and alerts&lt;/strong&gt; – If you have a monitoring system in place, you can trigger your webhook to send an alert (via email, sms, etc.) to the responsible person/team whenever a server goes down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API communication&lt;/strong&gt; – Besides helping apps communicate, webhooks can also be middlemen in API communication. For instance, when a transaction is completed, a payment gateway can use webhooks to notify your application so your system can respond accordingly in time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Third-party webhook integration&lt;/strong&gt; – As you’ll shortly see, you can integrate webhooks with various third-party software, such as CRM systems, project management tools, e-commerce platforms, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Examples of webhooks
&lt;/h2&gt;

&lt;p&gt;Now, as promised, let me show you some real-world uses and examples of webhooks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Slack
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://slack.com/" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; allows you to modify the platform to send a notification to a channel whenever a critical error occurs in your web application. For example, when the error occurs, the webhook will send a detailed message to a specific Slack channel, with the payload containing all the details and a link to the logs.&lt;/p&gt;

&lt;p&gt;Here’s an example of a JSON payload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "channel": "#alerts",
  "username": "ErrorBot",
  "text": "A critical error occurred in the web application:\n*Error Message:* Unexpected token in JSON\n*Timestamp:* 2024-07-25T14:30:00Z\n*Logs:* &amp;lt;http://example.com/logs/error-1234&amp;gt;",
  "icon_emoji": ":warning:"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here’s a &lt;strong&gt;code breakdown&lt;/strong&gt; with principles you can apply to other examples as well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;**"channel":**&lt;/code&gt; – Specifies the Slack channel where the message should be sent.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**"username":**&lt;/code&gt;– Sets the username that appears next to the message in the Slack channel.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**"text":**&lt;/code&gt; – The main content of the message that provides the information about the error.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**"icon_emoji":**&lt;/code&gt; – Sets the emoji that appears next to the message.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, did you know that you can combine Slack, Zapier, and ESPs? My colleague Piotr talks about it in his &lt;a href="https://mailtrap.io/blog/slack-email/#Webhooks" rel="noopener noreferrer"&gt;Slack email integration article&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub
&lt;/h3&gt;

&lt;p&gt;With &lt;a href="https://docs.github.com/en/webhooks/about-webhooks" rel="noopener noreferrer"&gt;GitHub webhooks&lt;/a&gt;, you can make a webhook send a notification to a CI/CD service to trigger a build when a new push is made to a repository.&lt;/p&gt;

&lt;p&gt;Here’s what you’d have to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to your repository on GitHub&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Settings&lt;/strong&gt; → &lt;strong&gt;Webhooks&lt;/strong&gt; → &lt;strong&gt;Add webhook&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enter the &lt;strong&gt;Payload URL&lt;/strong&gt; of your CI/CD service (e.g., Jenkins)&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;application/json&lt;/strong&gt; as the Content type&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Just the push event for the event&lt;/strong&gt; to trigger the webhook&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add webhook&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, you need to set up a new job to handle builds in your CI/CD service and configure it to listen for incoming webhooks from GitHub. And finally, parse the incoming JSON payload to extract relevant information.&lt;/p&gt;

&lt;p&gt;JSON example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "ref": "refs/heads/main",
  "before": "9c54a35c4d76d567bb5e4b2387bd2c5b4bc1c8d2",
  "after": "de8251ff97a4b5b2e8ad488ebcbd4b12c8d8b987",
  "repository": {
    "id": 123456,
    "name": "example-repo",
    "full_name": "user/example-repo"
  },
  "pusher": {
    "name": "user",
    "email": "user@example.com"
  },
  "commits": [
    {
      "id": "de8251ff97a4b5b2e8ad488ebcbd4b12c8d8b987",
      "message": "Fixed bug in API",
      "timestamp": "2024-07-25T14:30:00Z",
      "url": "https://github.com/user/example-repo/commit/de8251ff97a4b5b2e8ad488ebcbd4b12c8d8b987"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Stripe
&lt;/h3&gt;

&lt;p&gt;Now, let’s say you want to update the order status when a payment is successful. Who do you call? &lt;a href="https://stripe.com/" rel="noopener noreferrer"&gt;Stripe&lt;/a&gt; and webhooks, of course!&lt;/p&gt;

&lt;p&gt;Here’s how the process would look like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to Stripe and navigate to &lt;strong&gt;Developers&lt;/strong&gt; → &lt;strong&gt;Webhooks&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add endpoint&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Enter the &lt;strong&gt;Endpoint URL&lt;/strong&gt; of your server &lt;/li&gt;
&lt;li&gt;Select the events you want to listen to (e.g., &lt;strong&gt;charge.succeeded&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add endpoint&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, you’d set up a route in your server to listen to incoming HTTP POST requests from Stripe, verify the Stripe signature, and parse the incoming JSON payload to extract new data.&lt;/p&gt;

&lt;p&gt;JSON example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "id": "evt_1HUz9LFbuFVVSY1hKwJMcHmy",
  "object": "event",
  "api_version": "2020-08-27",
  "created": 1599677774,
  "data": {
    "object": {
      "id": "ch_1HUz8zFbuFVVSY1hkWfyJMWP",
      "object": "charge",
      "amount": 2000,
      "currency": "usd",
      "description": "Payment for order #1234",
      "status": "succeeded"
    }
  },
  "livemode": false,
  "type": "charge.succeeded"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this setup, your server would process the payload and event type and elegantly update the order status in your database. &lt;/p&gt;

&lt;p&gt;Moreover, you can even send a confirmation message with the payment details to the customer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shopify
&lt;/h3&gt;

&lt;p&gt;Okay, so you’ve successfully set up webhooks to update orders, but how do you notify your packaging/delivery service that a new order has been created? It’s simple—set up a webhook in Shopify.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://shopify.dev/docs/apps/build/webhooks" rel="noopener noreferrer"&gt;Shopify.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjwrfgfqwqj8w2573xeau.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjwrfgfqwqj8w2573xeau.png" alt="Image description" width="800" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here’s how you can set them up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to your Shopify admin panel&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Settings&lt;/strong&gt; → &lt;strong&gt;Notifications&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Scroll down to &lt;strong&gt;Webhooks&lt;/strong&gt; and click &lt;strong&gt;Create webhook&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Event&lt;/strong&gt; as &lt;strong&gt;Order creation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enter the URL where you want to receive data&lt;/li&gt;
&lt;li&gt;Choose JSON as the format and click &lt;strong&gt;Save webhook&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The next few steps will sound familiar: set up a route in your server to handle POST requests from Shopify and (you know it by now) parse the incoming JSON payload to extract data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "id": 820982911946154508,
  "email": "user@example.com",
  "closed_at": null,
  "created_at": "2024-07-25T14:30:00-04:00",
  "updated_at": "2024-07-25T14:30:00-04:00",
  "number": 234,
  "note": null,
  "token": "1234567890abcdef",
  "gateway": "credit_card",
  "test": false,
  "total_price": "298.50",
  "subtotal_price": "298.50",
  "total_weight": 0,
  "total_tax": "0.00",
  "currency": "USD",
  "financial_status": "paid",
  "confirmed": true,
  "total_discounts": "0.00",
  "total_line_items_price": "298.50",
  "cart_token": null,
  "buyer_accepts_marketing": true,
  "name": "#1001",
  "total_price_usd": "298.50",
  "line_items": [
    {
      "id": 466157049,
      "variant_id": 39072856,
      "title": "Awesome Product",
      "quantity": 1,
      "price": "199.00",
      "sku": "12345",
      "variant_title": null,
      "vendor": "Awesome Vendor",
      "fulfillment_service": "manual",
      "product_id": 12345678,
      "requires_shipping": true,
      "taxable": true,
      "gift_card": false,
      "name": "Awesome Product",
      "variant_inventory_management": null,
      "properties": [],
      "product_exists": true,
      "fulfillable_quantity": 1,
      "grams": 0,
      "total_discount": "0.00",
      "fulfillment_status": null
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Mailtrap
&lt;/h3&gt;

&lt;p&gt;I know, I know, this chapter seems like your typical CTA section where I ask you to buy something from us but trust me, I won’t. Providing a Mailtrap webhook example seemed only logical as I’m well acquainted with the platform.&lt;/p&gt;

&lt;p&gt;Anyhow, let’s imagine you want to make your &lt;a href="https://mailtrap.io/blog/send-email-in-laravel/" rel="noopener noreferrer"&gt;Laravel app send emails&lt;/a&gt; and keep an eye out on key &lt;a href="https://mailtrap.io/blog/email-deliverability/" rel="noopener noreferrer"&gt;deliverability&lt;/a&gt; metrics. In such a case, you could use Mailtrap webhooks, which will provide you with information on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deliveries&lt;/li&gt;
&lt;li&gt;Bounces&lt;/li&gt;
&lt;li&gt;Unsubscribes&lt;/li&gt;
&lt;li&gt;Spam complaints&lt;/li&gt;
&lt;li&gt;Rejections&lt;/li&gt;
&lt;li&gt;Soft bounces&lt;/li&gt;
&lt;li&gt;Suspensions&lt;/li&gt;
&lt;li&gt;Opens&lt;/li&gt;
&lt;li&gt;Clicks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhax1i68ku60e2ml8yc9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhax1i68ku60e2ml8yc9w.png" alt="Image description" width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here’s a JSON example from our &lt;a href="https://api-docs.mailtrap.io/docs/mailtrap-api-docs/127a373cd0493-receive-events" rel="noopener noreferrer"&gt;webhook documentation&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "events": [
    {
      "event": "delivery",
      "email": "mike@mailtrap.io",
      "category": "Password reset",
      "message_id": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
      "sending_stream": "bulk",
      "event_id": "aaaaaaaa-bbbb-cccc-ddd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To learn how to set them up, you can simply follow our in-depth &lt;a href="https://help.mailtrap.io/article/102-webhooks" rel="noopener noreferrer"&gt;knowledge base article&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  When shouldn’t you use webhooks?
&lt;/h2&gt;

&lt;p&gt;As with everything in life, even webhooks have their downsides. So, here are some cases when you shouldn’t use them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High-frequency event triggers&lt;/strong&gt; – Webhooks can become overwhelmed if your app generates a large number of events in a short period, which can lead to performance issues or, even worse, data loss.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Solution&lt;/em&gt;: Batch processing, message queues&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Unreliable internet connection&lt;/em&gt; – Like hotel receptionists needing coffee to stay awake during long night shifts, webhooks need a stable internet connection to be reliable middlemen between the sender and the receiver. Without a stable connection, you risk facing data loss or delayed processing.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Solution&lt;/em&gt;: Regular polling, message queueing system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handling sensitive data&lt;/strong&gt; – If you’re handling sensitive data, you should be aware that webhooks can pose a security risk without any encryption or authentication system in place.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Solution&lt;/em&gt;: HMAC verification, IP whitelisting, SSL/TLS, authentication tokens, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lastly, I’d also suggest you pass webhooks if you think you don’t need to &lt;strong&gt;act on the data immediately&lt;/strong&gt;. In such a case, you’d be better off using batch processing or simply regular polling.&lt;/p&gt;

&lt;p&gt;Moreover, webhooks don’t support &lt;strong&gt;bi-directional syncs&lt;/strong&gt; or &lt;strong&gt;HTTP action methods&lt;/strong&gt; such as PATCH or DELETE. For these purposes, APIs would be your best bet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;And there you have it; now you know what the catch is with webhooks! &lt;/p&gt;

&lt;p&gt;If you want to cement your knowledge, why not try out webhooks yourself and learn in practice by trial and error? For this, I recommend following our &lt;a href="https://mailtrap.io/blog/what-are-webhooks-and-how-to-use-them/" rel="noopener noreferrer"&gt;step-by-step tutorial on using webhooks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus tip&lt;/strong&gt;: you can test webhooks on the conveniently named &lt;a href="https://webhook.site/#!/view/f0745456-113a-4f31-b28c-ecda1579fb75" rel="noopener noreferrer"&gt;Webhooks.site&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Up for more reads? I found the &lt;a href="https://progrium.github.io/blog/2007/05/03/web-hooks-to-revolutionize-the-web/" rel="noopener noreferrer"&gt;original article about webhooks&lt;/a&gt; from 2007, written by their creator, John Lindsay, super interesting. Or, even better, visit the Mailtrap &lt;a href="https://mailtrap.io/blog/" rel="noopener noreferrer"&gt;blog&lt;/a&gt; and read all things email!&lt;/p&gt;

&lt;p&gt;We appreciate you chose this article to find &lt;a href="https://mailtrap.io/blog/what-are-webhooks/" rel="noopener noreferrer"&gt;the examples of webhooks&lt;/a&gt;. If you want to discover more useful information on related topics, follow Mailtrap blog!&lt;/p&gt;

</description>
      <category>webhooks</category>
      <category>api</category>
    </item>
    <item>
      <title>How to Send Emails with Email API: Practical Examples in Popular Languages and Frameworks</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Tue, 02 Jul 2024 17:27:45 +0000</pubDate>
      <link>https://dev.to/idjuric660/how-to-send-emails-with-email-api-practical-examples-in-popular-languages-and-frameworks-1ecn</link>
      <guid>https://dev.to/idjuric660/how-to-send-emails-with-email-api-practical-examples-in-popular-languages-and-frameworks-1ecn</guid>
      <description>&lt;p&gt;In this article, I’ll show you how to send emails using an email API in various programming languages and frameworks. &lt;/p&gt;

&lt;p&gt;I’ll also break down the differences between SMTP and email APIs, but if you’re already aware of them and your needs, feel free to skip ahead by clicking on some of the following links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/api-send-email/#Send-emails-in-PHP"&gt;PHP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/api-send-email/#Send-emails-in-Laravel"&gt;Laravel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/api-send-email/#Send-emails-in-Python"&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://mailtrap.io/blog/api-send-email/#Send-emails-in-Nodejs"&gt;Node.js&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note that as my API of choice, I’ll be using &lt;a href="https://mailtrap.io/email-sending/"&gt;Email API&lt;/a&gt;, a part of the Mailtrap Email Delivery Platform. However, the core principles in this article can be applied to any &lt;a href="https://mailtrap.io/blog/best-email-api/"&gt;email API provider&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Mailtrap Email API
&lt;/h2&gt;

&lt;p&gt;Mailtrap Email API is based on the &lt;a href="https://ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm"&gt;REST principle&lt;/a&gt;s, which classifies it as &lt;a href="https://www.ibm.com/topics/rest-apis#:~:text=IBM,transfer%20(REST)%20architectural%20style."&gt;REST, or RESTful API&lt;/a&gt;. These types of APIs offer greater flexibility and, as you’ll notice, are super easy to work with as they use standard HTTP methods (e.g., GET, POST, PUT, DELETE), which most developers are familiar with.&lt;/p&gt;

&lt;p&gt;Here’s what you need to do to get started with Mailtrap API and integrate it into your project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sign up for a &lt;a href="https://mailtrap.io/signin"&gt;free Mailtrap account&lt;/a&gt;&lt;/strong&gt;: You can sign up using your Google, GitHub, or Office 365 accounts, or, if you prefer, simply use your email address.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11cmlzrd8xme1wqmqh9h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11cmlzrd8xme1wqmqh9h.png" alt="Image description" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Verify your domain&lt;/strong&gt;: Navigate to the “Sending Domains” tab and click “Add Domain.” Enter your domain name and confirm by clicking the “Add” button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdaewoyt9w731wv6bxx3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdaewoyt9w731wv6bxx3.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Update DNS records&lt;/strong&gt;: Mailtrap will provide and automatically authenticate specific DNS records (SPF, DKIM, DMARC) that should be added to your domain provider’s DNS settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Tip: here’s a detailed &lt;a href="https://help.mailtrap.io/article/110-get-started-mailtrap-email-sending"&gt;Getting Started Guide&lt;/a&gt; to help you out.&lt;/em&gt; 👀&lt;/p&gt;

&lt;p&gt;Once your domain is verified, you can integrate your application with Mailtrap’s Email API. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Access API credentials&lt;/strong&gt;: Go to the Sending Domains tab, select your verified domain, and open the “Integration” tab. Here, you’ll find credentials for both Transactional and Bulk streams.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehol0czbfjuvgkj8wbao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehol0czbfjuvgkj8wbao.png" alt="Image description" width="800" height="721"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Build your HTTP request&lt;/strong&gt;: Use the provided API credentials to configure an authenticated HTTP request in your preferred programming language or framework.

&lt;ul&gt;
&lt;li&gt;Mailtrap also offers and maintains official SDKs for &lt;a href="https://github.com/railsware/mailtrap-php"&gt;PHP&lt;/a&gt;, &lt;a href="https://github.com/railsware/mailtrap-python"&gt;Python&lt;/a&gt;, &lt;a href="https://github.com/railsware/mailtrap-ruby"&gt;Ruby&lt;/a&gt;, &lt;a href="https://github.com/railsware/mailtrap-nodejs"&gt;Node.js&lt;/a&gt;, and &lt;a href="https://github.com/railsware/mailtrap-elixir"&gt;Elixir&lt;/a&gt;. I’ll show you how to use them in a jiffy.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run your script&lt;/strong&gt;: Execute your email sending script. If everything is set up correctly, your email will land in the recipient’s inbox, and you will see it in the “Email Logs” section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5t8wmmepuh7vckwal8tf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5t8wmmepuh7vckwal8tf.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Each domain has unique API tokens. To manage these, go to Settings → API Tokens and click “Add Token” if you need additional tokens. Additionally, Mailtrap’s API supports email templates, attachments, custom variables, and email categories. For detailed information, check the &lt;a href="https://api-docs.mailtrap.io/"&gt;API documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Send emails in PHP
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;For a comprehensive guide on sending emails in PHP, read the &lt;a href="https://mailtrap.io/blog/php-email-sending/"&gt;full article here&lt;/a&gt;&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/f8oxbmJY7Jw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Since we already covered the Mailtrap installation process, let’s start by integrating the &lt;a href="https://github.com/railsware/mailtrap-php"&gt;Mailtrap PHP SDK&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, install Mailtrap PHP SDK using one of the following &lt;a href="https://getcomposer.org/"&gt;Composer&lt;/a&gt; commands: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;With Symfony HTTP client&lt;/strong&gt;:
&lt;code&gt;composer require railsware/mailtrap-php symfony/http-client nyholm/psr7&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;With Guzzle HTTP client&lt;/em&gt;:
&lt;code&gt;composer require railsware/mailtrap-php guzzlehttp/guzzle php-http/guzzle7-adapter&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Mailtrap API Client uses &lt;a href="https://www.php-fig.org/psr/psr-18/"&gt;PSR-18 client&lt;/a&gt; abstraction and is thus not hard-coupled to any library that sends HTTP messages. It gives you the flexibility to choose which HTTP client you want to use.&lt;/p&gt;

&lt;p&gt;However, it’s recommended to use &lt;a href="https://symfony.com/"&gt;Symfony&lt;/a&gt; for its fast performance, ease of use, flexibility, and strong community support.&lt;/p&gt;

&lt;p&gt;Next, using the below code, you can send a plain text email using the Mailtrap PHP SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

use Mailtrap\Config;
use Mailtrap\EmailHeader\CategoryHeader;
use Mailtrap\EmailHeader\CustomVariableHeader;
use Mailtrap\Helper\ResponseHelper;
use Mailtrap\MailtrapClient;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\Header\UnstructuredHeader;

require __DIR__ . '/vendor/autoload.php';

// Your API token from here https://mailtrap.io/api-tokens
$apiKey = getenv('MAILTRAP_API_KEY');
$mailtrap = new MailtrapClient(new Config($apiKey));

$email = (new Email())
    -&amp;gt;from(new Address('example@your-domain-here.com', 'Mailtrap Test'))
    -&amp;gt;replyTo(new Address('reply@your-domain-here.com'))
    -&amp;gt;to(new Address('email@example.com', 'Jon')) // Single recipient
    -&amp;gt;priority(Email::PRIORITY_HIGH)
    -&amp;gt;subject('Best practices of building HTML emails')
    -&amp;gt;text('Hey! Learn the best practices of building HTML emails and play with ready-to-go templates. Mailtrap's Guide on How to Build HTML Email is live on our blog');

// Headers
$email-&amp;gt;getHeaders()
    -&amp;gt;addTextHeader('X-Message-Source', 'domain.com')
    -&amp;gt;add(new UnstructuredHeader('X-Mailer', 'Mailtrap PHP Client')); // the same as addTextHeader

// Custom Variables
$email-&amp;gt;getHeaders()
    -&amp;gt;add(new CustomVariableHeader('user_id', '45982'))
    -&amp;gt;add(new CustomVariableHeader('batch_id', 'PSJ-12'));

// Category (should be only one)
$email-&amp;gt;getHeaders()
    -&amp;gt;add(new CategoryHeader('Integration Test'));

try {
    $response = $mailtrap-&amp;gt;sending()-&amp;gt;emails()-&amp;gt;send($email); // Email sending API (real)

    var_dump(ResponseHelper::toArray($response)); // body (array)
} catch (Exception $e) {
    echo 'Caught exception: ',  $e-&amp;gt;getMessage(), "\n";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script initializes the Mailtrap client with your API key, which can be found in the Integration tab under the Sending Domains section. &lt;/p&gt;

&lt;p&gt;It then creates a new email message and sets various properties, such as the &lt;code&gt;sender&lt;/code&gt;, &lt;code&gt;recipient&lt;/code&gt;, &lt;code&gt;subject&lt;/code&gt;, and &lt;code&gt;content&lt;/code&gt;. Additionally, it adds custom headers and variables. &lt;/p&gt;

&lt;p&gt;Finally, the script sends the email using the &lt;code&gt;send() function&lt;/code&gt; and outputs the response or an error message if the email fails to send.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML email
&lt;/h3&gt;

&lt;p&gt;Sending HTML emails in PHP couldn’t be easier as all you need to do is add the &lt;code&gt;-&amp;gt;html()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;To save you some time, I’ve prepared a code you can use to send an HTML email to multiple recipients and attach files to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

use Mailtrap\Config;
use Mailtrap\EmailHeader\CategoryHeader;
use Mailtrap\EmailHeader\CustomVariableHeader;
use Mailtrap\Helper\ResponseHelper;
use Mailtrap\MailtrapClient;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\Header\UnstructuredHeader;
use Symfony\Component\Mime\Part\DataPart;

require __DIR__ . '/vendor/autoload.php';

// Your API token from here https://mailtrap.io/api-tokens


$apiKey = “MAILTRAP_API_KEY”;
$mailtrap = new MailtrapClient(new Config($apiKey));

$email = (new Email())
    -&amp;gt;from(new Address('example@your-domain-here.com', 'Mailtrap Test'))
    -&amp;gt;replyTo(new Address('reply@your-domain-here.com'))
    -&amp;gt;to(new Address('email@example.com', 'Jon'))
    -&amp;gt;priority(Email::PRIORITY_HIGH)
    -&amp;gt;cc('mailtrapqa@example.com')
    -&amp;gt;addCc('staging@example.com')
    -&amp;gt;bcc('mailtrapdev@example.com')
    -&amp;gt;subject('Best practices of building HTML emails')
    -&amp;gt;text('Hey! Learn the best practices of building HTML emails and play with ready-to-go templates. Mailtrap's Guide on How to Build HTML Email is live on our blog')
    -&amp;gt;html(
        '&amp;lt;html&amp;gt;
        &amp;lt;body&amp;gt;
        &amp;lt;p&amp;gt;&amp;lt;br&amp;gt;Hey&amp;lt;/br&amp;gt;
        Learn the best practices of building HTML emails and play with ready-to-go templates.&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;&amp;lt;a href="https://mailtrap.io/blog/build-html-email/"&amp;gt;Mailtrap's Guide on How to Build HTML Email&amp;lt;/a&amp;gt; is live on our blog&amp;lt;/p&amp;gt;
        &amp;lt;img src="cid:logo"&amp;gt;
        &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;'
    )
    -&amp;gt;embed(fopen('https://mailtrap.io/wp-content/uploads/2021/04/mailtrap-new-logo.svg', 'r'), 'logo', 'image/svg+xml');

// Add an attachment
$email-&amp;gt;attachFromPath('/path/to/your/file.pdf', 'Filename.pdf', 'application/pdf');

// Headers
$email-&amp;gt;getHeaders()
    -&amp;gt;addTextHeader('X-Message-Source', 'domain.com')
    -&amp;gt;add(new UnstructuredHeader('X-Mailer', 'Mailtrap PHP Client')); // the same as addTextHeader

// Custom Variables
$email-&amp;gt;getHeaders()
    -&amp;gt;add(new CustomVariableHeader('user_id', '45982'))
    -&amp;gt;add(new CustomVariableHeader('batch_id', 'PSJ-12'));

// Category (should be only one)
$email-&amp;gt;getHeaders()
    -&amp;gt;add(new CategoryHeader('Integration Test'));

try {
    $response = $mailtrap-&amp;gt;sending()-&amp;gt;emails()-&amp;gt;send($email); // Email sending API (real)

    var_dump(ResponseHelper::toArray($response)); // body (array)
} catch (Exception $e) {
    echo 'Caught exception: ',  $e-&amp;gt;getMessage(), "\n";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Send emails in Laravel
&lt;/h2&gt;

&lt;p&gt;To quickly integrate the Mailtrap email API into your Laravel application, you can use the &lt;a href="https://github.com/railsware/mailtrap-php"&gt;official PHP SDK&lt;/a&gt; and docs for the &lt;a href="https://github.com/railsware/mailtrap-php/tree/main/src/Bridge/Laravel"&gt;Laravel framework bridge&lt;/a&gt;. The Mailtrap library is also fully compatible with Laravel 9.x and above. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;For more information, read our complete guide on &lt;a href="https://mailtrap.io/blog/send-email-in-laravel/"&gt;sending emails in Laravel&lt;/a&gt; which covers different sending methods as well.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/lsna1S8y1vg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Nonetheless, here’s an example of sending plain-text emails in Laravel;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the Mailtrap PHP client and dependencies using composer:
&lt;code&gt;composer require railsware/mailtrap-php symfony/http-client nyholm/psr7&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Next, add Mailtrap transport into your &lt;em&gt;&lt;strong&gt;config/mail.php&lt;/strong&gt;&lt;/em&gt; file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

return [
    /*
    |--------------------------------------------------------------------------
    | Mailer Configurations
    |--------------------------------------------------------------------------
    */
    'mailers' =&amp;gt; [

            // start mailtrap transport
            'mailtrap' =&amp;gt; [
                'transport' =&amp;gt; 'mailtrap'
            ],
            // end mailtrap transport

    ]
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, to the Laravel &lt;strong&gt;&lt;em&gt;.env&lt;/em&gt;&lt;/strong&gt; file, add your Mailtrap credentials:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MAIL_MAILER="mailtrap"
MAILTRAP_HOST="send.api.mailtrap.io"
MAILTRAP_API_KEY="YOUR_API_KEY_HERE"
MAIL_FROM_ADDRESS="name@registered_domain.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To send the email, create a &lt;em&gt;&lt;strong&gt;mailable&lt;/strong&gt;&lt;/em&gt; class:
&lt;code&gt;php artisan make:mail WelcomeMail&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Open the newly created &lt;em&gt;&lt;strong&gt;WelcomeMail.php&lt;/strong&gt;&lt;/em&gt; file in &lt;em&gt;&lt;strong&gt;app/Mail&lt;/strong&gt;&lt;/em&gt; directory, and configure it as follows:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Attachment;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Mail\Mailables\Headers;
use Illuminate\Queue\SerializesModels;
use Mailtrap\EmailHeader\CategoryHeader;
use Mailtrap\EmailHeader\CustomVariableHeader;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\Header\UnstructuredHeader;

class WelcomeMail extends Mailable
{
    use Queueable, SerializesModels;

    private string $name;

    /**
     * Create a new message instance.
     */
    public function __construct(string $name)
    {
        $this-&amp;gt;name = $name;
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        return new Envelope(
            from: new Address('jeffrey@example.com', 'Jeffrey Way'),
            replyTo: [
                      new Address('taylor@example.com', 'Taylor Otwell'),
                  ],
            subject: 'Welcome Mail',
            using: [
                      function (Email $email) {
                          // Headers
                          $email-&amp;gt;getHeaders()
                              -&amp;gt;addTextHeader('X-Message-Source', 'example.com')
                              -&amp;gt;add(new UnstructuredHeader('X-Mailer', 'Mailtrap PHP Client'))
                          ;

                          // Custom Variables
                          $email-&amp;gt;getHeaders()
                              -&amp;gt;add(new CustomVariableHeader('user_id', '45982'))
                              -&amp;gt;add(new CustomVariableHeader('batch_id', 'PSJ-12'))
                          ;

                          // Category (should be only one)
                          $email-&amp;gt;getHeaders()
                              -&amp;gt;add(new CategoryHeader('Integration Test'))
                          ;
                      },
                  ]
        );
    }

    /**
     * Get the message content definition.
     */
    public function content(): Content
    {
        return new Content(
            view: 'mail.welcome-email',
            with: ['name' =&amp;gt; $this-&amp;gt;name],
        );
    }

    /**
     * Get the attachments for the message.
     *
     * @return array&amp;lt;int, \Illuminate\Mail\Mailables\Attachment&amp;gt;
     */
    public function attachments(): array
    {
        return [
           Attachment::fromPath('https://mailtrap.io/wp-content/uploads/2021/04/mailtrap-new-logo.svg')
                -&amp;gt;as('logo.svg')
                -&amp;gt;withMime('image/svg+xml'),
        ];
    }

    /**
     * Get the message headers.
     */
    public function headers(): Headers
    {
        return new Headers(
            'custom-message-id@example.com',
            ['previous-message@example.com'],
            [
                'X-Custom-Header' =&amp;gt; 'Custom Value',
            ],
        );
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a Blade view template for your email in &lt;strong&gt;&lt;em&gt;resources/views/emails/welcome.blade.php&lt;/em&gt;&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;p&amp;gt;Hey {{$name}}!&amp;lt;/p&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;p&amp;gt;Welcome to the party! You've just joined the coolest club in town.&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To the &lt;em&gt;&lt;strong&gt;app/routes/console.php&lt;/strong&gt;&lt;/em&gt; file, add the CLI router:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

use App\Mail\WelcomeMail;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Mail;

/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
*/

Artisan::command('send-welcome-mail', function () {
    Mail::to('testreceiver@gmail.com')-&amp;gt;send(new WelcomeMail("Jon"));
    // Also, you can use specific mailer if your default mailer is not "mailtrap" but you want to use it for welcome mails
    // Mail::mailer('mailtrap')-&amp;gt;to('testreceiver@gmail.com')-&amp;gt;send(new WelcomeMail("Jon"));
})-&amp;gt;purpose('Send welcome mail');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Lastly, to send your email, call the CLI command:
&lt;code&gt;php artisan send-welcome-mail&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  HTML email
&lt;/h3&gt;

&lt;p&gt;To send an HTML email via Laravel, all you have to do is add HTML code to the Blade file we previously created (e.g., &lt;strong&gt;welcome.blade.php&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;For a basic HTML message, use the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&amp;gt;

    &amp;lt;style&amp;gt;
        p {
            font-size: 12px;
        }

        .signature {
            font-style: italic;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div&amp;gt;
    &amp;lt;p&amp;gt;Hey {{ $name }},&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Can your Laravel app send emails yet? 😉 &amp;lt;/p&amp;gt;
    &amp;lt;p class="signature"&amp;gt;Mailtrap&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;If you want to customize your HTML emails further, be sure to give our Laravel HTML article a read.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Send emails in Python
&lt;/h2&gt;

&lt;p&gt;Below I’ll show a basic example of how to send an email in Python. However, if you’d like to understand how to handle more complex email-sending scenarios in Python, I recommend reading our &lt;a href="https://mailtrap.io/blog/python-send-email"&gt;dedicated article&lt;/a&gt; on this topic.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wDYADks8VBM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Similarly to other languages and frameworks, once the Mailtrap account is all set, I’ll use &lt;a href="https://github.com/railsware/mailtrap-python"&gt;Mailtrap’s official Python SDK&lt;/a&gt; to streamline the process of sending emails via the API in Python. &lt;/p&gt;

&lt;p&gt;Here’s how it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your terminal and run the following command: 
&lt;code&gt;pip install mailtrap&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Send a plain-text email by running this script:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from mailtrap import Mail, Address, MailtrapClient

# Create a Mail object with basic details for a plain text email
mail = Mail(
    # Specify the sender's email address and optional name
    sender=Address(email="mailtrap@example.com", name="Mailtrap Test"),
    # Specify one or more recipients; here we use a list with a single recipient
    to=[Address(email="your@email.com", name="Your Name")],
    # Subject of the email
    subject="Simple Plain Text Email",
    # The plain text content of the email
    text="This is a plain text email sent using the Mailtrap SDK. Simple and straightforward.",
    # Optional: categorize this email for easier sorting or management in the Mailtrap service
    category="Test",
    # Optional: Additional headers can be specified, but are not required for plain text emails
    headers={"X-Example-Header": "HeaderValue"}
)

# Initialize the MailtrapClient with your API token
client = MailtrapClient(token="your-api-key")

# Send the email using the client's send method
client.send(mail)

print("Plain text email sent successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Don’t forget to insert your Mailtrap credentials (e.g., verified sending domain and API key).&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML email
&lt;/h3&gt;

&lt;p&gt;To send an HTML email, simply adjust the script above by specifying the &lt;code&gt;html&lt;/code&gt; parameter in the Mail object with the &lt;code&gt;HTML content&lt;/code&gt;. Like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from mailtrap import Mail, Address, MailtrapClient

# Create a Mail object for sending an HTML email
mail = Mail(
    sender=Address(email="mailtrap@example.com", name="Mailtrap Test"),
    to=[Address(email="recipient@email.com", name="Recipient Name")],
    subject="Your HTML Email Subject Here",
    text="This is a fallback text for email clients that don't render HTML",
    html="""
    &amp;lt;!DOCTYPE html&amp;gt;
    &amp;lt;html&amp;gt;
        &amp;lt;head&amp;gt;
            &amp;lt;title&amp;gt;Email Title&amp;lt;/title&amp;gt;
        &amp;lt;/head&amp;gt;
        &amp;lt;body&amp;gt;
            &amp;lt;h1&amp;gt;Hello, World!&amp;lt;/h1&amp;gt;
            &amp;lt;p&amp;gt;This is an &amp;lt;strong&amp;gt;HTML email&amp;lt;/strong&amp;gt; sent from the Mailtrap Python SDK.&amp;lt;/p&amp;gt;
            &amp;lt;p&amp;gt;Here's a link: &amp;lt;a href="https://example.com"&amp;gt;Visit Example.com&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
    """,
    # You can categorize this email or add custom headers as needed
    category="HTML Email",
    headers={"X-Custom-Header": "Value"}
)

# Initialize the MailtrapClient with your API token
client = MailtrapClient(token="your-api-key")

# Send the email
client.send(mail)

print("HTML email sent successfully.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Send emails in Node.js
&lt;/h2&gt;

&lt;p&gt;In this chapter, I’ll show you how to add email-sending functionality to your Node.js application with Mailtrap’s &lt;a href="https://www.npmjs.com/package/mailtrap"&gt;official SDK&lt;/a&gt; that allows easy integration.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Wa9KDiB7C_I"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The examples I’ll show you will be basic, but, if you’re feeling dev-savvy, feel free to check out our detailed article on &lt;a href="https://mailtrap.io/blog/send-emails-with-nodejs/"&gt;sending emails in Node.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, let’s start by installing Mailtrap Node.js package with either &lt;a href="https://www.npmjs.com/"&gt;npm&lt;/a&gt; or &lt;a href="https://yarnpkg.com/"&gt;yarn&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install mailtrap

# or, if you are using yarn:

yarn add mailtrap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, send a plain text email by running the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { MailtrapClient } from "mailtrap"

/**
 * For this example to work, you need to set up a sending domain,
 * and obtain a token that is authorized to send from the domain.
 */

const TOKEN = "&amp;lt;YOUR-TOKEN-HERE&amp;gt;";
const SENDER_EMAIL = "&amp;lt;SENDER ADDRESS@YOURDOMAIN.COM&amp;gt;";
const RECIPIENT_EMAIL = "&amp;lt;RECIPIENT@EMAIL.COM&amp;gt;";

const client = new MailtrapClient({ token: TOKEN });

const sender = { name: "Mailtrap Test", email: SENDER_EMAIL };

client
  .send({
    from: sender,
    to: [{ email: RECIPIENT_EMAIL }],
    subject: "Hello from Mailtrap!",
    text: "Welcome to Mailtrap Sending!",
  })
  .then(console.log)
  .catch(console.error);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As Mailtrap’s Node.js package uses &lt;a href="https://nodejs.org/api/esm.html"&gt;ECMAScript (ES) modules&lt;/a&gt;, I suggest adding &lt;code&gt;“type:” “module”&lt;/code&gt; in your &lt;strong&gt;package.json&lt;/strong&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML email
&lt;/h3&gt;

&lt;p&gt;Use the following code snippet to send an HTML email:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { MailtrapClient } from "mailtrap"

/**
 * For this example to work, you need to set up a sending domain,
 * and obtain a token that is authorized to send from the domain.
 * @see https://help.mailtrap.io/article/69-sending-domain-setup
 */

const TOKEN = "&amp;lt;YOUR-TOKEN-HERE&amp;gt;";
const SENDER_EMAIL = "&amp;lt;SENDER@YOURDOMAIN.COM&amp;gt;";
const RECIPIENT_EMAIL = "&amp;lt;RECIPIENT@EMAIL.COM&amp;gt;";

const client = new MailtrapClient({ token: TOKEN });

client
  .send({
    category: "test",
    custom_variables: {
      hello: "world",
      year: 2022,
      anticipated: true,
    },
    from: { name: "Mailtrap Test", email: SENDER_EMAIL },
    to: [{ email: RECIPIENT_EMAIL }],
    subject: "Hello from Mailtrap!",
    html: `
    &amp;lt;!doctype html&amp;gt;
    &amp;lt;html&amp;gt;
      &amp;lt;head&amp;gt;
        &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&amp;gt;
      &amp;lt;/head&amp;gt;
      &amp;lt;body style="font-family: sans-serif;"&amp;gt;
        &amp;lt;div style="display: block; margin: auto; max-width: 600px;" class="main"&amp;gt;
          &amp;lt;h1 style="font-size: 18px; font-weight: bold; margin-top: 20px"&amp;gt;Congrats for sending test email with Mailtrap!&amp;lt;/h1&amp;gt;
          &amp;lt;p&amp;gt;Inspect it using the tabs you see above and learn how this email can be improved.&amp;lt;/p&amp;gt;
          &amp;lt;p&amp;gt;Now send your email using our fake SMTP server and integration of your choice!&amp;lt;/p&amp;gt;
          &amp;lt;p&amp;gt;Good luck! Hope it works.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;!-- Example of invalid for email html/css, will be detected by Mailtrap: --&amp;gt;
        &amp;lt;style&amp;gt;
          .main { background-color: white; }
          a:hover { border-left-width: 1em; min-height: 2em; }
        &amp;lt;/style&amp;gt;
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  `,
  })
  .then(console.log)
  .catch(console.error);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Test emails and email sending on staging
&lt;/h2&gt;

&lt;p&gt;This article has ~4,000 words and about 50% of that is code only. Considering this, you can easily imagine the not-so-small potential for errors while implementing the code into your app.&lt;/p&gt;

&lt;p&gt;Hence, it’s of utmost importance to test your email-sending functionality. This is an industry-standard practice that ensures your code works properly, your emails are going where they’re supposed to while avoiding spam filters, and much more.&lt;/p&gt;

&lt;p&gt;Consider it as tasting a dish you’ve just prepared. After putting in all the effort to make it, you wouldn’t want to serve an omelette that’s not salty at all, would you? 🧂&lt;/p&gt;

&lt;p&gt;For this purpose, especially if you’ve used our email API for sending, I recommend using &lt;a href="https://mailtrap.io/automated-email-testing/"&gt;Mailtrap Testing API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/AveaJc6c3fI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Via Mailtrap Testing API, you can run the following commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inbox&lt;/strong&gt; – Create new inboxes, reset credentials, receive messages, clean one or all messages in the inbox, mark messages as read, and manage users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project&lt;/strong&gt; – Create new projects, update/delete them, and manage their users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcx3hgcc8jbykjlebq8kv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcx3hgcc8jbykjlebq8kv.png" alt="Image description" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Email content&lt;/strong&gt; – Inspect the raw HTML (you can also download it), text, and get detailed info about the HTML part, including a list of possible errors, along with message attachments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx8wa1ggjvghcjpwqyu7j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx8wa1ggjvghcjpwqyu7j.png" alt="Image description" width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bcc and message headers&lt;/strong&gt; – Receive and test message headers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F420cfujt7tjvg5l338b5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F420cfujt7tjvg5l338b5.png" alt="Image description" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deliverability&lt;/strong&gt; – You get a SPAM report, domain blacklisting details, and a spam score, which if you keep under 5, can proactively solve potential problems such as hitting the spam filters and ending up in the junk folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49vpnlnkx0o7of055k35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49vpnlnkx0o7of055k35.png" alt="Image description" width="800" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the Email Testing API, you can also &lt;a href="https://mailtrap.io/blog/email-templates-testing-api/"&gt;test your templates&lt;/a&gt;. Simply enable sandbox, specify the inbox ID, receive template test, and then send it through the API in the production environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmpzmrijg3cg2jsn50gia.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmpzmrijg3cg2jsn50gia.png" alt="Image description" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, Mailtrap Email Testing API is quite easy to integrate for testing, automation, and testing automated sequences.&lt;/p&gt;

&lt;p&gt;For example, here’s how you would test emails using Python and &lt;a href="https://mailtrap.io/automated-email-testing/"&gt;Mailtrap Email Testing API&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Establish a connection to the API endpoint using &lt;code&gt;http.client.HTTPSConnection&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Define your email content (e.g., recipients, sender, subject, text content, attachments, etc.)&lt;/li&gt;
&lt;li&gt;Make a POST request to the API with your payload and necessary headers, including your API token for authorization. Here’s how it looks in practice:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import http.client
import json

def test_send_email():
    conn = http.client.HTTPSConnection("sandbox.api.mailtrap.io")

    payload = {
        "to": [{"email": "john_doe@example.com", "name": "John Doe"}],
        "cc": [{"email": "jane_doe@example.com", "name": "Jane Doe"}],
        "bcc": [{"email": "james_doe@example.com", "name": "Jim Doe"}],
        "from": {"email": "sales@example.com", "name": "Example Sales Team"},
        "attachments": [
            {
                "content": "base64_encoded_content_here",
                "filename": "index.html",
                "type": "text/html",
                "disposition": "attachment"
            }
        ],
        "custom_variables": {"user_id": "45982", "batch_id": "PSJ-12"},
        "headers": {"X-Message-Source": "dev.mydomain.com"},
        "subject": "Your Example Order Confirmation",
        "text": "Congratulations on your order no. 1234",
        "category": "API Test"
    }

    headers = {
        'Content-Type': "application/json",
        'Accept': "application/json",
        'Api-Token': "your_api_token_here"  # Replace with your real API token
    }

    # Convert the payload to a JSON string
    json_payload = json.dumps(payload)

    # Make the POST request
    conn.request("POST", "/api/send/inbox_id", json_payload, headers)  # Replace 'inbox_id' with your real inbox ID

    # Get the response
    response = conn.getresponse()
    data = response.read()

    print(data.decode("utf-8"))

if __name__ == "__main__":
    test_send_email()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, if you’re interested in more information, be sure to check the &lt;a href="https://api-docs.mailtrap.io/docs/mailtrap-api-docs/bcf61cdc1547e-send-email-including-templates"&gt;API docs&lt;/a&gt; for details on API testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[Test Emails with Mailtrap for Free]&lt;/strong&gt;(&lt;a href="https://mailtrap.io/register/signup"&gt;https://mailtrap.io/register/signup&lt;/a&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Whether you’ve opted for sending emails with API or, perhaps, &lt;a href="https://dev.towith%20SMTP"&gt;with SMTP&lt;/a&gt;, I hope you now have a better understanding of the intricacies involved in the email backend. &lt;/p&gt;

&lt;p&gt;And one more thing: I heartily invite you to further explore our &lt;a href="https://mailtrap.io/blog/"&gt;blog&lt;/a&gt;, where you can learn how to send emails in various languages and frameworks and read articles such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://mailtrap.io/blog/sending-email-using-java/"&gt;Send Emails in Java: Guide with Code Examples&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://mailtrap.io/blog/sending-emails-with-nodemailer/"&gt;Nodemailer: Tutorial with Code Snippets&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/laravel-notification-tutorial/"&gt;How to Send Beautiful Mail Notifications in Laravel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/flask-email-sending/"&gt;Flask Send Email: Tutorial with Code Snippets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We appreciate you chose this article to know more about methods of &lt;a href="https://mailtrap.io/blog/api-send-email/"&gt;sending emails via API and SMTP&lt;/a&gt;. To read more articles on related topics, follow Mailrap Blog!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Node.js Contact Form: How to Create One, Validate Data, and Send Emails</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Fri, 31 May 2024 13:50:02 +0000</pubDate>
      <link>https://dev.to/idjuric660/nodejs-contact-form-how-to-create-one-validate-data-and-send-emails-1pk4</link>
      <guid>https://dev.to/idjuric660/nodejs-contact-form-how-to-create-one-validate-data-and-send-emails-1pk4</guid>
      <description>&lt;p&gt;In this step-by-step tutorial, I’ll show you how to create a Node.js contact form, give it a personal touch, retrieve and validate data from it, and then send emails through the form via SMTP or API.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: you’ll need Node.js 6+ or any version released since May 2018 installed on your machine for the provided code snippets to work.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a Node.js contact form
&lt;/h2&gt;

&lt;p&gt;As you’re reading this article, I’m assuming you know how to install Node.js and create a new project, so allow me to keep it brief and get straight into setting up the project.&lt;/p&gt;

&lt;p&gt;However, to freshen up your knowledge, you can check out this article on &lt;a href="https://blog.apify.com/how-to-install-nodejs/"&gt;installing Node.js&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up the project
&lt;/h3&gt;

&lt;p&gt;First things first, let’s install some dependencies for our backend by opening the terminal and entering the following commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;**mkdir contact-form-test &amp;amp;&amp;amp; cd contact-form-test**&lt;/code&gt; – By running this command, we create a folder for our project, ensuring our project file will be within it instead of the current directory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**npm init -y**&lt;/code&gt; – This will create a package.json file that manages project dependencies and configurations.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**npm i express nodemailer**&lt;/code&gt; – We need to install Express.js library and Nodemailer module as we will need them for setting up our server and sending emails with SMTP, respectively.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**npm i -D nodemon**&lt;/code&gt; – This is a dev dependency that automates the process of restarting our server whenever we change our code, allowing us to see the changes we made without having us manually restart the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you install all the dependencies, your &lt;strong&gt;package.json&lt;/strong&gt; file should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "contact-form-test",          // Project name
  "version": "1.0.0",                   // Project version
  "description": "",                    // Description of the project
  "main": "server.js",                  // Entry point file of the project
  "scripts": {
    "dev": "nodemon --watch public --watch server.js --ext js,html,css", // Script to run the server with nodemon for development
    "start": "node server.js"           // Script to start the server normally
  },
  "keywords": [],                       // Keywords related to the project
  "author": "",                         // Author of the project
  "license": "ISC",                     // License type
  "dependencies": {
    "express": "^4.19.2",               // Express web server framework
    "nodemailer": "^6.9.13"             // Nodemailer for sending emails via SMTP
  },
  "devDependencies": {
    "nodemon": "^3.1.0"                 // Nodemon for automatically restarting the server on code changes
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bonus tips&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;**npm i dotenv**&lt;/code&gt; – Although optional, this command installs the dotenv package, which loads environment variables where you can safely store your authentication credentials such as an API key. All you have to do is run the command, create an .env file in the root of your project directory, and paste your desired creds in there.&lt;/li&gt;
&lt;li&gt;Starting from &lt;a href="https://nodejs.org/en/blog/release/v20.6.0"&gt;v20.6.0, Node.js&lt;/a&gt; has built-in support for &lt;strong&gt;.env&lt;/strong&gt; files for configuring environment variables. So it is not necessary to use the dotenv package, but a lot of projects still depend on dotenv, so it’s still the de facto standard.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Configuring the server
&lt;/h3&gt;

&lt;p&gt;Next, in our project folder, let’s create a new &lt;strong&gt;.js&lt;/strong&gt; file called &lt;strong&gt;server.js&lt;/strong&gt; which we refer to in the production script from the &lt;strong&gt;package.json&lt;/strong&gt; file. &lt;/p&gt;

&lt;p&gt;Then, simply paste the following code snippet into the &lt;strong&gt;server.js&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const app = express();
const path = require('path');


const PORT = process.env.PORT || 3000;


// Middleware
app.use(express.static('public'));
app.use(express.json());


app.get('/', (req, res) =&amp;gt; {
    res.sendFile(path.join(__dirname, 'public', 'contactform.html'));
});


app.post('/send-email', (req, res) =&amp;gt; {
    console.log(req.body);
    res.send('Data received');
});


app.listen(PORT, () =&amp;gt; {
    console.log(`Server running on port ${PORT}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Later in the article, we’ll use the server.js file to add Nodemailer as a transport via &lt;a href="https://mailtrap.io/blog/node-js-contact-form/#Send-email-from-Nodejs-contact-form-using-SMTP"&gt;SMTP&lt;/a&gt; and an &lt;a href="https://mailtrap.io/blog/node-js-contact-form/#Send-email-from-Nodejs-contact-form-using-API"&gt;API logic&lt;/a&gt; to send emails through our contact form.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the contact form
&lt;/h3&gt;

&lt;p&gt;Now, let’s create a new &lt;strong&gt;public&lt;/strong&gt; folder called public for the static files (&lt;strong&gt;style.css&lt;/strong&gt;, &lt;strong&gt;contactform.html&lt;/strong&gt;, and &lt;strong&gt;app.js&lt;/strong&gt;) we’re going to be using for this contact form.&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;contactform.html&lt;/strong&gt; file, enter the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt; &amp;lt;!-- Specifies the character encoding for the HTML document --&amp;gt;
    &amp;lt;link rel="stylesheet" href="/style.css"&amp;gt; &amp;lt;!-- Link to external CSS file for styling --&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com"&amp;gt; &amp;lt;!-- Preconnect to load fonts faster --&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Poppins&amp;amp;display=swap" rel="stylesheet"&amp;gt; &amp;lt;!-- Google fonts link for 'Poppins' font --&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt; &amp;lt;!-- Responsive design meta tag --&amp;gt;
    &amp;lt;title&amp;gt;Contact Form&amp;lt;/title&amp;gt; &amp;lt;!-- Title of the document shown in the browser tab --&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="form-container"&amp;gt; &amp;lt;!-- Container for the form to style it specifically --&amp;gt;
        &amp;lt;form class="contact-form"&amp;gt; &amp;lt;!-- Form element where user inputs will be submitted --&amp;gt;
            &amp;lt;h2&amp;gt;CONTACT&amp;lt;/h2&amp;gt; &amp;lt;!-- Heading of the form --&amp;gt;
            &amp;lt;input type="text" id="name" placeholder="Full name"&amp;gt;&amp;lt;br&amp;gt; &amp;lt;!-- Input field for name --&amp;gt;
            &amp;lt;input type="email" id="email" placeholder="Email"&amp;gt;&amp;lt;br&amp;gt; &amp;lt;!-- Input field for email, validates email format --&amp;gt;
            &amp;lt;input type="text" id="subject" placeholder="Subject"&amp;gt;&amp;lt;br&amp;gt; &amp;lt;!-- Input field for subject --&amp;gt;
            &amp;lt;textarea id="message" placeholder="Message" cols="30" rows="10"&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;br&amp;gt; &amp;lt;!-- Textarea for longer message input --&amp;gt;
            &amp;lt;input type="submit" class="submit" value="Send Message"&amp;gt; &amp;lt;!-- Submit button to send the form data --&amp;gt;
        &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script src="/app.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Link to external JavaScript file for scripting --&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I’ve added annotations in this code snippet as well to help you navigate through it, but feel free to delete them for a cleaner-looking code. 🙂&lt;/p&gt;

&lt;h3&gt;
  
  
  Styling the contact form
&lt;/h3&gt;

&lt;p&gt;How about we tackle the frontend for a bit and add a personal touch to our contact form? &lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;style.css&lt;/strong&gt; file, enter the following code which will make our contact form prettier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Global styles for all elements to ensure consistency */
* {
    margin: 0;                          /* Remove default margin */
    padding: 0;                         /* Remove default padding */
    box-sizing: border-box;             /* Include padding and border in the element's total width and height */
    font-family: 'Poppins', sans-serif; /* Set a consistent font family throughout the app */
}


/* Styling for the html and body elements */
html, body {
    background: #c0b7b7;                /* Set the background color for the entire page */
}


/* Container for the form providing relative positioning context */
.form-container {
    position: relative;                 /* Positioning context for absolute positioning inside */
    left: 20%;                          /* Position the container 20% from the left side of the viewport */
    width: 60%;                         /* Set the width of the container to 60% of the viewport width */
    height: 100vh;                      /* Set the height to be 100% of the viewport height */
    background-color: white;            /* Set the background color of the form container */
}


/* Styling for the contact form itself */
.contact-form {
    position: absolute;                 /* Position the form absolutely within its parent container */
    top: 10%;                           /* Position the form 10% from the top of its container */
    left: 10%;                          /* Position the form 10% from the left of its container */
    width: 80%;                         /* The form width is 80% of its container */
    min-height: 600px;                  /* Minimum height for the form */
}


/* Styling for input fields and textarea within the form */
input, textarea {
    width: 100%;                        /* Make input and textarea elements take up 100% of their parent's width */
    margin-top: 2rem;                   /* Add top margin to space out the elements */
    border: none;                       /* Remove default borders */
    border-bottom: 1px solid black;     /* Add a bottom border for a minimalistic look */
    padding: 10px; /* Add padding for better readability */
}


/* Styling for the submit button */
.submit {
    border: 1px solid black;            /* Add a solid border around the submit button */
    padding: 1rem;                      /* Add padding inside the button for better clickability */
    text-align: center;                 /* Center the text inside the button */
    background-color: white;            /* Set the background color of the button */
    cursor: pointer;                    /* Change the cursor to a pointer to indicate it's clickable */
}


/* Styling for the submit button on hover */
.submit:hover {
    opacity: 0.6;                       /* Change the opacity when hovered to give a visual feedback */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see how your contact form looks, you can save the file and enter the following command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, you should see the message saying that your contact form is being hosted on the custom port you defined in your &lt;strong&gt;.env&lt;/strong&gt; file or the default port 3000, which allows traffic to reach it. &lt;/p&gt;

&lt;p&gt;Finally, paste the following link in your browser’s URL bar: &lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt; and you should see your contact form in its full glory. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to collect data from a Node.js contact form
&lt;/h2&gt;

&lt;p&gt;To collect data from our Node.js contact form, we will add functionality for handling form submissions using JavaScript, which will capture form data and send it to the server without reloading the page.&lt;/p&gt;

&lt;p&gt;For this, we’ll use an &lt;strong&gt;AJAX request&lt;/strong&gt;, which allows us to avoid a full-page reload.&lt;/p&gt;

&lt;p&gt;I’ve made this easy for you, so all you have to do is navigate to your &lt;strong&gt;app.js&lt;/strong&gt; file and enter the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const contactForm = document.querySelector('.contact-form');
const name = document.getElementById('name');
const email = document.getElementById('email');
const subject = document.getElementById('subject');
const message = document.getElementById('message');


contactForm.addEventListener('submit', (e) =&amp;gt; {
    e.preventDefault();  // Prevent the default form submission


    const formData = {
        name: name.value,
        email: email.value,
        subject: subject.value,
        message: message.value
    };


    try {
        const response = await fetch('/send-email', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(formData)
        });


        // Wait for JSON response to be parsed
        const result = await response.json();


        if (!response.ok) {
            // If the response is not OK, handle it by showing an alert
            alert(`Failed to send message: ${result.message}`);
            return;  // Exit the function early if there's an error
        }


        // Check application-specific status from JSON when response is OK
        if (result.status === 'success') {
            alert('Email sent');


            // Reset form fields after successful submission
            name.value = '';
            email.value = '';
            subject.value = '';
            message.value = '';
        } else {
            // Handle application-level failure not caught by response.ok
            alert('Operation failed: ' + result.message);
        }


    } catch (error) {
        // Handle any exceptions that occur during fetch
        console.error('Error:', error);
        alert('Network error or cannot connect to server');
    }


});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: I used the fetch API here which is a more modern alternative to ‘XMLHttpRequest’ and leverages async/await syntax for better error handling.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to validate data from a contact form
&lt;/h2&gt;

&lt;p&gt;To validate data from a contact form in Node.js, you can either use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/deep-email-validator"&gt;Deep email validator&lt;/a&gt;&lt;/strong&gt; – A comprehensive, MIT-certified, dependency package that makes sure an email is valid by running it through several different checks. It validates RegEx, common typos, disposable email blacklists, DNS records, and SMTP server responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regex expressions&lt;/strong&gt; – Patterns used to match character combinations in strings, ensuring that inputs conform to a predefined format. They provide a more basic level of validation compared to dependency packages like Deep email validator.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Deep email validator module
&lt;/h3&gt;

&lt;p&gt;To install the Deep email validator, I typically use the npm command or &lt;a href="https://yarnpkg.com/en/"&gt;Yarn&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i deep-email-validator

# or

yarn add deep-email-validator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then after importing const &lt;code&gt;{ validate } = require('deep-email-validator');&lt;/code&gt; simply add the following code in your &lt;strong&gt;/send-email&lt;/strong&gt; controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Endpoint to handle form submission and send email
app.post('/send-email', async (req, res) =&amp;gt; {
   const { name, email, subject, message } = req.body;


   if (!name || !email || !subject || !message) {
       return res.status(400).json({ status: 'error', message: 'Missing required fields!' })
   }


   // Validate the email
   const validationResult = await validate(email);


   if (!validationResult.valid) {
       return res.status(400).json({
           status: 'error',
           message: 'Email is not valid. Please try again!',
           reason: validationResult.reason
       });
   }


   // Email sending logic


   // Placeholder response for a successful email submission
   res.status(200).json({
       status: 'success',
       message: 'Email successfully sent'
   });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information on Deep email validator, consult the official &lt;a href="https://github.com/mfbx9da4/deep-email-validator"&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Regular expressions for email validation
&lt;/h3&gt;

&lt;p&gt;If you’d rather run basic ReGex checks against the email IDs instead of using a dependency package, you can paste the following code into your project file (e.g., &lt;strong&gt;server.js&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const emailRegex = 

/^[a-zA-Z0-9.!#$%&amp;amp;'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/


function isEmailValid(email) {
    // Check if the email is defined and not too long
    if (!email || email.length &amp;gt; 254) return false;

    // Use a single regex check for the standard email parts
    if (!emailRegex.test(email)) return false;

    // Split once and perform length checks on the parts
    const parts = email.split("@");
    if (parts[0].length &amp;gt; 64) return false;

    // Perform length checks on domain parts
    const domainParts = parts[1].split(".");
    if (domainParts.some(part =&amp;gt; part.length &amp;gt; 63)) return false;

    // If all checks pass, the email is valid
    return true;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in your &lt;strong&gt;/send-email&lt;/strong&gt; route add the following code to perform email validation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Endpoint to handle form submission and send email
app.post('/send-email', async (req, res) =&amp;gt; {
   const { name, email, subject, message } = req.body;


   if (!name || !email || !subject || !message) {
       res.status(400).json({ status: 'error', message: 'Missing required fields!' })
   }


   // Validate the email
   if (!isEmailValid(email)) {
       return res.status(400).json({
           status: 'error',
           message: 'Email is not valid. Please try again!'
       });
   }


   // Email sending logic


   // Placeholder response for a successful email submission
   res.status(200).json({
       status: 'success',
       message: 'Email successfully sent'
   });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more details on validating emails in Node.js, feel free to consult our &lt;a href="https://mailtrap.io/blog/nodejs-email-validation/"&gt;dedicated article&lt;/a&gt;, where you can also learn how to verify emails by sending an activation link/code the end users activate from their inbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to add reCAPTCHA
&lt;/h2&gt;

&lt;p&gt;Now, let’s add a reCAPTCHA to our Node.js contact form to make sure no robots fill it out. 🤖&lt;/p&gt;

&lt;p&gt;First, you need to get your ‘&lt;strong&gt;SITE KEY&lt;/strong&gt;’ and ‘&lt;strong&gt;SECRET KEY&lt;/strong&gt;’ from the &lt;a href="https://www.google.com/recaptcha/admin/create"&gt;Google reCAPTCHA admin console&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this example we will be using Challenge (v2), so be sure to select it during creation and leave the default “I’m not a robot Checkbox”. &lt;/p&gt;

&lt;p&gt;Also, since we are testing from a local computer we need to add ‘&lt;strong&gt;localhost&lt;/strong&gt;’ to allowed domains during creation. &lt;br&gt;
&lt;strong&gt;Note&lt;/strong&gt;: if you are in production you would need to use your own domains. And to use this code, simply copy your &lt;strong&gt;SITE KEY&lt;/strong&gt; and &lt;strong&gt;SECRET KEY&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Next, in our &lt;strong&gt;contactform.html&lt;/strong&gt;, add the following code snippet just before the closing of the head section:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://www.google.com/recaptcha/api.js" async defer&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Load google recaptcha API --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside our form, we can add the reCAPTCHA element after the textarea like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt; &amp;lt;!-- Google recaptcha element --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: don’t forget to replace &lt;strong&gt;YOUR_SITE_KEY&lt;/strong&gt; with your actual &lt;strong&gt;SITE KEY&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Then, we need to update our &lt;strong&gt;app.js&lt;/strong&gt; inside the public folder to pass the reCAPTCHA token to our &lt;code&gt;**formData**&lt;/code&gt; so the backend can verify it. To do this, after the &lt;strong&gt;&lt;code&gt;e.preventDefault();&lt;/code&gt;&lt;/strong&gt; paste the following code :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Get the reCAPTCHA token
   const recaptchaToken = grecaptcha.getResponse();


   if (!recaptchaToken) {
       alert('Please complete the reCAPTCHA');
       return;  // Exit the function early if reCAPTCHA is not completed
   }


   const formData = {
       name: name.value,
       email: email.value,
       subject: subject.value,
       message: message.value,
       'g-recaptcha-response': recaptchaToken
   };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify the reCAPTCHA on the server side, we need to make a request. For this, we can use the built in Node.js ‘&lt;strong&gt;https&lt;/strong&gt;’, or a package like ‘&lt;strong&gt;node-fetch&lt;/strong&gt;’ or ‘&lt;strong&gt;axios&lt;/strong&gt;’.&lt;/p&gt;

&lt;p&gt;And since Node.js ver 18, the fetch method is available on the global scope natively, so let’s use ‘&lt;strong&gt;fetch&lt;/strong&gt;’.&lt;/p&gt;

&lt;p&gt;First, in our server.js let’s create a function to verify the reCAPTCHA (make sure to add the &lt;strong&gt;SECRET KEY&lt;/strong&gt; as &lt;strong&gt;RECAPTCHA_SECRET_KEY&lt;/strong&gt; in environment variables else the verification will not succeed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Function to verify reCAPTCHA
async function verifyRecaptcha(token) {
   const recaptchaSecret = process.env.RECAPTCHA_SECRET_KEY;
   const recaptchaUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${recaptchaSecret}&amp;amp;response=${token}`;


   const response = await fetch(recaptchaUrl, { method: 'POST' });
   const result = await response.json();


   return result.success;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in our /send-email endpoint we can update our code to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Endpoint to handle form submission and send email
app.post('/send-email', async (req, res) =&amp;gt; {
   const { name, email, subject, message, 'g-recaptcha-response': recaptchaToken } = req.body;


   if (!name || !email || !subject || !message || !recaptchaToken) {
       res.status(400).json({ status: 'error', message: 'Missing required fields!' })
   }


   // Verify the reCAPTCHA token
   const isRecaptchaValid = await verifyRecaptcha(recaptchaToken);
   if (!isRecaptchaValid) {
       return res.status(400).json({
           status: 'error',
           message: 'reCAPTCHA verification failed. Please try again.'
       });
   }


   // Validate the email
   const validationResult = await validate(email);


   if (!validationResult.valid) {
       return res.status(400).json({
           status: 'error',
           message: 'Email is not valid. Please try again!',
           reason: validationResult.reason
       });
   }


   // Email sending logic


   // Placeholder response for a successful email submission
   res.status(200).json({
       status: 'success',
       message: 'Email successfully sent'
   });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Send email from Node.js contact form using SMTP
&lt;/h2&gt;

&lt;p&gt;Now that we have our Node.js contact form flow in place, let’s add an email-sending functionality to it. &lt;/p&gt;

&lt;p&gt;For this, we’ll need two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nodemailer&lt;/strong&gt; – If you’re reading this article, I’m guessing you already have Nodemailer installed, but if you don’t, &lt;a href="https://mailtrap.io/blog/sending-emails-with-nodemailer/#How-to-install-Nodemailer"&gt;here’s how to install it&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMTP credentials&lt;/strong&gt; – With Nodemailer, you can leverage any SMTP server like, for example, Gmail. However, Gmail has some significant limitations, about which you can find out more in our dedicated &lt;a href="https://mailtrap.io/blog/nodemailer-gmail/#Gmail-SMTP-limitations-and-possible-issues"&gt;Nodemailer Gmail tutorial&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, to overcome Gmail limitations, we’ll set up Mailtrap Email Sending instead, as the SMTP service in our Nodemailer transporter object. It offers an infrastructure with high deliverability rates by default and by design, plus it’s easy to use.&lt;/p&gt;

&lt;p&gt;First, create a &lt;a href="https://mailtrap.io/register/signup"&gt;free Mailtrap account&lt;/a&gt; and verify your domain. It only takes a couple of minutes, and you can watch the video we’ve prepared for you as a step-by-step tutorial.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/vAfUyKpWj_M"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Then, proceed to the &lt;strong&gt;Sending Domains&lt;/strong&gt; section, choose your domain, and under &lt;strong&gt;Integration&lt;/strong&gt;, select your preferred stream (Transactional, in this case). There, you will find your SMTP credentials, which you can easily paste into the Nodemailer config file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6jul87l7dvl4iqgvwjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6jul87l7dvl4iqgvwjh.png" alt="Image description" width="800" height="709"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Speaking of Nodemailer configuration, let’s insert it into the &lt;strong&gt;server.js&lt;/strong&gt; file beneath the comment &lt;strong&gt;// Create a transporter object&lt;/strong&gt;, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Create a transporter object
const transporter = nodemailer.createTransport({
  host: 'live.smtp.mailtrap.io',
  port: 587,
  secure: false, // use false for STARTTLS; true for SSL on port 465
  auth: {
    user: '1a2b3c4d5e6f7g',
    pass: '1a2b3c4d5e6f7g',
  }
});

// Configure the mailoptions object
const mailOptions = {
  from: 'yourusername@email.com',
  to: 'yourfriend@email.com',
  subject: 'Sending Email using Node.js',
  text: 'That was easy!'
};

// Send the email
transporter.sendMail(mailOptions, (error, info) =&amp;gt;{
  if (error) {
    console.log('Error:' error);
    return res.status(500).json({ status: 'error', message: 'Failed to send email due to server error.' });
  } else {
    console.log('Email sent: ' + info.response);
    return res.status(200).json({
               status: 'success',
               message: 'Email successfully sent'
           });
  }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, just insert your Mailtrap credentials into their respectable fields, including &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, and &lt;code&gt;pass&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the end, your &lt;strong&gt;server.js&lt;/strong&gt; file should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require('dotenv').config();
const express = require('express');
const { validate } = require('deep-email-validator');
const path = require('path');


const app = express();
const PORT = process.env.PORT || 3000;


// Middleware
app.use(express.static('public'));
app.use(express.json());


app.get('/', (req, res) =&amp;gt; {
   res.sendFile(path.join(__dirname, 'public', 'contactform.html'));
});


// Function to verify reCAPTCHA
async function verifyRecaptcha(token) {
   const recaptchaSecret = process.env.RECAPTCHA_SECRET_KEY;
   const recaptchaUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${recaptchaSecret}&amp;amp;response=${token}`;


   const response = await fetch(recaptchaUrl, { method: 'POST' });
   const result = await response.json();


   return result.success;
}


// Endpoint to handle form submission and send email
app.post('/send-email', async (req, res) =&amp;gt; {
   const { name, email, subject, message, 'g-recaptcha-response': recaptchaToken } = req.body;


   if (!name || !email || !subject || !message || !recaptchaToken) {
       return res.status(400).json({ status: 'error', message: 'Missing required fields!' })
   }


   // Verify the reCAPTCHA token
   const isRecaptchaValid = await verifyRecaptcha(recaptchaToken);
   if (!isRecaptchaValid) {
       return res.status(400).json({
           status: 'error',
           message: 'reCAPTCHA verification failed. Please try again.'
       });
   }


   // Validate the email
   const validationResult = await validate(email);


   if (!validationResult.valid) {
       return res.status(400).json({
           status: 'error',
           message: 'Email is not valid. Please try again!',
           reason: validationResult.reason
       });
   }


   // Email sending logic
   // Create a transporter object
   const transporter = nodemailer.createTransport({
       host: process.env.SMTP_HOST,
       port: process.env.SMTP_PORT,
       secure: false, // use false for STARTTLS; true for SSL on port 465
       auth: {
           user: process.env.SMTP_USER,
           pass: process.env.SMTP_PASS,
       }
   });


   // Configure the mailoptions object
   const mailOptions = {
       from: process.env.EMAIL_FROM,
       to: process.env.EMAIL_TO,
       replyTo: email,
       subject: subject,
       text: `From: ${name}\nEmail:${email}\n\n${message}`
   };


   // Send the email
   transporter.sendMail(mailOptions, (error, info) =&amp;gt; {
       if (error) {
           console.log('Error:', error);
           return res.status(500).json({ status: 'error', message: 'Failed to send email due to server error.' });


       } else {
           console.log('Email sent: ' + info.response);
           return res.status(200).json({
               status: 'success',
               message: 'Email successfully sent'
           });
       }
   });
});


app.listen(PORT, () =&amp;gt; {
   console.log(`Server running on port ${PORT}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To safely store your Mailtrap credentials, you can use the environment variable, or the &lt;strong&gt;.env&lt;/strong&gt; file, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PORT=3200
SMTP_HOST='live.smtp.mailtrap.io'
SMTP_PORT=587
SMTP_USER='1a2b3c4d5e6f7g'
SMTP_PASS='1a2b3c4d5e6f7g'
EMAIL_FROM='yourusername@email.com'
EMAIL_TO='contactformrecipient@yourmail.com'
RECAPTCHA_SECRET_KEY='SECRET-KEY'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;a href="https://mailtrap.io/register/signup"&gt;Send Emails with Mailtrap for Free&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Send email from Node.js contact form using API
&lt;/h2&gt;

&lt;p&gt;If you want to automate your contact form’s email-sending functionality, you can again rely on Mailtrap as it has a robust &lt;a href="https://github.com/railsware/mailtrap-nodejs"&gt;sending package&lt;/a&gt;. The package itself is regularly updated by a team of developers, lets you automate your sending process, and it’s super straightforward to use.&lt;/p&gt;

&lt;p&gt;First, you’ll need a &lt;a href="https://mailtrap.io/register/signup"&gt;Mailtrap account&lt;/a&gt;, which, if you don’t already have one, you can create by following the instructions provided in the previous chapter.&lt;/p&gt;

&lt;p&gt;Then, let’s install the Mailtrap package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install mailtrap

# or, if you are using yarn:

yarn add mailtrap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it’s installed, you can use the following code snippet for email sending:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { MailtrapClient } from "mailtrap"

/**
 * For this example to work, you need to set up a sending domain,
 * and obtain a token that is authorized to send from the domain.
 */

const TOKEN = "&amp;lt;YOUR-TOKEN-HERE&amp;gt;";
const SENDER_EMAIL = "&amp;lt;SENDER ADDRESS@YOURDOMAIN.COM&amp;gt;";
const RECIPIENT_EMAIL = "&amp;lt;RECIPIENT@EMAIL.COM&amp;gt;";

const client = new MailtrapClient({ token: TOKEN });

const sender = { name: "Mailtrap Test", email: SENDER_EMAIL };

client
  .send({
    from: sender,
    to: [{ email: RECIPIENT_EMAIL }],
    subject: "Hello from Mailtrap!",
    text: "Welcome to Mailtrap Sending!",
  })
 .then(response =&amp;gt; {
    console.log("Email sent successfully:", response);
  })
  .catch(error =&amp;gt; {
    console.error("Error sending email:", error);
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And for your convenience’s sake, here’s what your server.js file should look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require('dotenv').config();
const express = require('express');
const { MailtrapClient } = require('mailtrap');
const { validate } = require('deep-email-validator');
const path = require('path');


const app = express();
const PORT = process.env.PORT || 3000;


// Middleware
app.use(express.static('public'));
app.use(express.json());


app.get('/', (req, res) =&amp;gt; {
   res.sendFile(path.join(__dirname, 'public', 'contactform.html'));
});


// Function to verify reCAPTCHA
async function verifyRecaptcha(token) {
   const recaptchaSecret = process.env.RECAPTCHA_SECRET_KEY;
   const recaptchaUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${recaptchaSecret}&amp;amp;response=${token}`;


   const response = await fetch(recaptchaUrl, { method: 'POST' });
   const result = await response.json();


   return result.success;
}


// Endpoint to handle form submission and send email
app.post('/send-email', async (req, res) =&amp;gt; {
   const { name, email, subject, message, 'g-recaptcha-response': recaptchaToken } = req.body;


   if (!name || !email || !subject || !message || !recaptchaToken) {
       return res.status(400).json({ status: 'error', message: 'Missing required fields!' })
   }


   // Verify the reCAPTCHA token
   const isRecaptchaValid = await verifyRecaptcha(recaptchaToken);
   if (!isRecaptchaValid) {
       return res.status(400).json({
           status: 'error',
           message: 'reCAPTCHA verification failed. Please try again.'
       });
   }


   // Validate the email
   const validationResult = await validate(email);


   if (!validationResult.valid) {
       return res.status(400).json({
           status: 'error',
           message: 'Email is not valid. Please try again!',
           reason: validationResult.reason
       });
   }


   // Configure mailtrap client and define sender
   console.log(process.env.MAILTRAP_TOKEN);
   const client = new MailtrapClient({ token: process.env.MAILTRAP_TOKEN });
   const sender = { name: "NodeJS App", email: process.env.EMAIL_FROM };


   // Send email
   try {
       const response = await client.send({
           from: sender,
           to: [{ email: process.env.EMAIL_TO }],
           subject: subject,
           text: `From: ${name}\nEmail: ${email}\n\n${message}`,
       });


       console.log('Email sent: ', response.message_ids);
       res.status(200).json({
           status: 'success',
           message: 'Email successfully sent'
       });
   } catch (error) {
       console.log('Error:', error);
       res.status(500).json({ status: 'error', message: 'Failed to send email due to server error.' });
   }


});


app.listen(PORT, () =&amp;gt; {
   console.log(`Server running on port ${PORT}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to safely store your credentials in an environment variable, here’s what your &lt;strong&gt;.env&lt;/strong&gt; should look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PORT=3200
MAILTRAP_TOKEN='7ff93fc2453461800734fb5c8bbe735d'
EMAIL_FROM='yourusername@email.com'
EMAIL_TO='contactformrecipient@yourmail.com'
RECAPTCHA_SECRET_KEY='SECRET-KEY'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And voila! Your Node.js contact form can now send emails via API.&lt;/p&gt;

&lt;p&gt;Keep in mind that the code snippet I’ve shown you here is only for plain-text messages. If you wish to send HTML emails or add embedded images or attachments, please refer to the &lt;a href="https://github.com/railsware/mailtrap-nodejs/tree/main/examples"&gt;examples&lt;/a&gt; folder in the GitHub repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test email and email sending on staging
&lt;/h2&gt;

&lt;p&gt;If you’re making a contact form, the chances are that you’ll use it for collecting critical user information like email addresses, names, and other sensitive data. &lt;/p&gt;

&lt;p&gt;Hence, you need to make sure that your contact form’s functionality is spot on and that your submitted forms are reaching the desired addresses as they’re supposed to.&lt;/p&gt;

&lt;p&gt;And that’s exactly where email testing comes in—an industry-standard practice that makes sure your submission system is working as intended, that your emails are looking flawless, and more importantly, that your emails are not being marked as spam. &lt;/p&gt;

&lt;p&gt;Personally, I use &lt;a href="https://mailtrap.io/email-sandbox/"&gt;Mailtrap Email Testing&lt;/a&gt;, another integral part of Mailtrap Email Delivery Platform that offers a sandbox for you to inspect and debug emails in staging, dev, and QA environments.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/AveaJc6c3fI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;With Mailtrap Email Testing, you can preview how your emails look in different devices/clients, inspect their source HTML/CSS and easily fix any faulty lines of code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuo308iqo6ef1w1jp0tp8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuo308iqo6ef1w1jp0tp8.png" alt="Image description" width="800" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, thanks to the Spam Report feature, you will be aware of your spam score, which, if you keep under 5, prevents a considerable amount of potential &lt;a href="https://mailtrap.io/blog/email-deliverability/"&gt;email deliverability&lt;/a&gt; issues.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xn9i0eyts6brswajlt2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xn9i0eyts6brswajlt2.png" alt="Image description" width="800" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Besides these, you also get access to other features for improving your email deliverability, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Email preview in HTML form and raw text&lt;/li&gt;
&lt;li&gt;Email Testing API for &lt;a href="https://mailtrap.io/qa-automation/"&gt;QA automation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Multiple inboxes for different projects and stages&lt;/li&gt;
&lt;li&gt;User management, SSO&lt;/li&gt;
&lt;li&gt;Email templates testing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, let me show you how it works!&lt;/p&gt;

&lt;h3&gt;
  
  
  SMTP
&lt;/h3&gt;

&lt;p&gt;To start testing your emails with Nodemailer and SMTP, follow these steps: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;a href="https://mailtrap.io/register/signup"&gt;free Mailtrap account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Email Testing&lt;/strong&gt; and select your inbox&lt;/li&gt;
&lt;li&gt;Copy your credentials from the &lt;strong&gt;Integration&lt;/strong&gt; tab&lt;/li&gt;
&lt;li&gt;Insert the credentials into your &lt;strong&gt;server.js&lt;/strong&gt; file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also use Mailtrap’s ready-to-use integration, like so:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Nodemailer from the list of integrations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy53t6aju60tsaa8idf0q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy53t6aju60tsaa8idf0q.png" alt="Image description" width="800" height="727"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy and paste the code snippet into your &lt;strong&gt;server.js&lt;/strong&gt; file
Here’s what the snippet should look like:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const transport = nodemailer.createTransport({
  host: "sandbox.smtp.mailtrap.io",
  port: 2525,
  auth: {
    user: "1a2b3c4d5e6f7g",
    pass: "1a2b3c4d5e6f7g"
  }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;a href="https://mailtrap.io/register/signup"&gt;Test Emails with Mailtrap for Free&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  API
&lt;/h3&gt;

&lt;p&gt;Integrating Mailtrap &lt;a href="https://mailtrap.io/automated-email-testing/"&gt;Email Testing API&lt;/a&gt; for testing, automation, and testing automated sequences is as simple as using the following code snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require('dotenv').config();
const { MailtrapClient } = require('mailtrap');
const nodemailer = require('nodemailer');


/* The official mailtrap package doesn't support sending test emails, so we send a mail first with nodemailer */


/* Initialize nodemailer with SMTP configuration from environment variables. */
const transport = nodemailer.createTransport({
   host: process.env.SMTP_HOST,
   port: process.env.SMTP_PORT,
   auth: {
       user: process.env.SMTP_USER,
       pass: process.env.SMTP_PASS
   }
});


/* Asynchronously send a test email using nodemailer. */
async function sendTestEmail() {
   const info = await transport.sendMail({
       from: process.env.EMAIL_FROM,
       to: "user@domain.com",
       subject: "Mailtrap Email Testing",
       html: '&amp;lt;h1&amp;gt;Mailtrap Email Testing&amp;lt;/h1&amp;gt;',
       text: 'Mailtrap Email Testing'
   });


   console.log("Message sent: %s", info.messageId);
   return info;
}


/* Configure the Mailtrap client and fetch email information for testing and automation. */
const client = new MailtrapClient({
   token: process.env.MAILTRAP_TOKEN,
   testInboxId: process.env.TEST_INBOX_ID,
   accountId: process.env.ACCOUNT_ID
});


const inboxesClient = client.testing.inboxes;
const messagesClient = client.testing.messages;


/* Send the test email and then retrieve it from Mailtrap for analysis. */
sendTestEmail().then(() =&amp;gt; {
   inboxesClient.getList()
       .then(async (inboxes) =&amp;gt; {
           if (inboxes &amp;amp;&amp;amp; inboxes.length &amp;gt; 0) {
               const firstInboxId = inboxes[0].id;
               console.log(`First inbox ID: ${firstInboxId}`);


               const messages = await messagesClient.get(firstInboxId);
               if (messages &amp;amp;&amp;amp; messages.length &amp;gt; 0) {
                   const firstMessageId = messages[0].id;
                   console.log(`First message ID: ${firstMessageId}`);


                   const analysis = await messagesClient.getHtmlAnalysis(firstInboxId, firstMessageId);
                   console.log('HTML Analysis:', analysis);


                   const htmlMessage = await messagesClient.getHtmlMessage(firstInboxId, firstMessageId);
                   console.log('HTML Message:', htmlMessage);


                   const textMessage = await messagesClient.getTextMessage(firstInboxId, firstMessageId);
                   console.log('Text Message:', textMessage);


                   const headers = await messagesClient.getMailHeaders(firstInboxId, firstMessageId);
                   console.log('Mail Headers:', headers);


                   const eml = await messagesClient.getMessageAsEml(firstInboxId, firstMessageId);
                   console.log('Message as EML:', eml);


                   const htmlSource = await messagesClient.getMessageHtmlSource(firstInboxId, firstMessageId);
                   console.log('HTML Source:', htmlSource);


                   const rawMessage = await messagesClient.getRawMessage(firstInboxId, firstMessageId);
                   console.log('Raw Message:', rawMessage);


                   const spamScore = await messagesClient.getSpamScore(firstInboxId, firstMessageId);
                   console.log('Spam Score:', spamScore);


                   const emailMessage = await messagesClient.showEmailMessage(firstInboxId, firstMessageId);
                   console.log('Email Message:', emailMessage);


                   const updateStatus = await messagesClient.updateMessage(firstInboxId, firstMessageId, {
                       isRead: false
                   });
                   console.log('Update Status:', updateStatus);


                   // Forward the message (needs to be a confirmed email for forwarding in mailtrap)
                   // await messagesClient.forward(firstInboxId, firstMessageId, 'mock@mail.com');
                   // console.log('Message forwarded.');


                   // Delete the message
                   const response = await messagesClient.deleteMessage(firstInboxId, firstMessageId);
                   console.log('Delete Response:', response);


               } else {
                   console.log('No messages found in the first inbox.');
               }
           } else {
               console.log('No inboxes found.');
           }
       })
       .catch(error =&amp;gt; {
           console.error('Error fetching inboxes or messages:', error);
       });
}).catch(console.error);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this code, we are first sending a test email using Nodemailer and retrieving the information related to the test email programmatically. This can potentially be used to perform automation. This code only logs the information of the test email.&lt;/p&gt;

&lt;p&gt;And of course, here’s what your &lt;strong&gt;.env&lt;/strong&gt; file should look like for the Email Testing API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MAILTRAP_TOKEN=''
SMTP_HOST='sandbox.smtp.mailtrap.io'
SMTP_PORT=2525
SMTP_USER=''
SMTP_PASS=''
EMAIL_FROM=''
TEST_INBOX_ID=
ACCOUNT_ID=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information and use cases of Mailtrap Email Testing API, check out the &lt;a href="https://github.com/railsware/mailtrap-nodejs?tab=readme-ov-file#email-testing-api"&gt;official GitHub page&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;And with that, we’ve come to the end of the line!&lt;/p&gt;

&lt;p&gt;Now that you’ve got the ropes, you can style your Node.js contact form according to your artistic eye and make it function according to your application’s specific needs.&lt;/p&gt;

&lt;p&gt;So, code away, and be sure to give our &lt;a href="https://mailtrap.io/blog/"&gt;blog&lt;/a&gt; a read! We have a plethora of helpful JavaScript-related articles, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://mailtrap.io/blog/javascript-send-email/"&gt;JavaScript Send Email – Read This First&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/send-emails-with-nodejs/"&gt;Send and Receive Emails with Node JS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mailtrap.io/blog/sending-emails-with-nodemailer/"&gt;Sending Emails with Nodemailer Explained&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We appreciate you chose this article to know about &lt;a href="https://mailtrap.io/blog/node-js-contact-form/"&gt;creating a Node.js contact form&lt;/a&gt;. If you want to see more content on related topics, visit Mailtrap blog and explore it!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Office 365 SMTP: Setup and Configuration Explained</title>
      <dc:creator>Ivan Djuric</dc:creator>
      <pubDate>Wed, 01 May 2024 17:35:18 +0000</pubDate>
      <link>https://dev.to/idjuric660/office-365-smtp-setup-and-configuration-explained-3b7p</link>
      <guid>https://dev.to/idjuric660/office-365-smtp-setup-and-configuration-explained-3b7p</guid>
      <description>&lt;p&gt;In this guide, I dive deep into the ins and outs of Office 365, showing you what it’s best used for and how to configure it, while also providing you with some actual examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Office 365 SMTP server?
&lt;/h2&gt;

&lt;p&gt;SMTP, or Simple Mail Transfer Protocol, is an internet standard protocol responsible for delivering messages to the email server and relaying emails between senders and recipients. &lt;/p&gt;

&lt;p&gt;Thus, Office 365 is an SMTP service from Microsoft.&lt;/p&gt;

&lt;p&gt;However, in 2020, Office 365 was renamed to Microsoft 365.&lt;/p&gt;

&lt;p&gt;Microsoft 365 is a subscription-based service, which includes Office 365 SMTP. So, when you refer to the Office 365 SMTP, you refer to the Microsoft 365 SMTP.&lt;/p&gt;

&lt;p&gt;However, we’ll be using Office 365 to keep things simple.&lt;/p&gt;

&lt;h3&gt;
  
  
  Office  365 SMTP vs. Outlook SMTP
&lt;/h3&gt;

&lt;p&gt;Office 365 SMTP is often confused with Outlook SMTP on the internet, but don’t mix up the two, because Office 365 is subscription-based, whereas Outlook is free.&lt;/p&gt;

&lt;p&gt;Here are some differences between the two:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kpe8okwfojegu6a5gnu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kpe8okwfojegu6a5gnu.png" alt="Image description" width="516" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why should you use Office 365 as a SMTP server?
&lt;/h2&gt;

&lt;p&gt;Some of the most common Office 365 SMTP use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sending transactional emails – Password resets and order confirmations are some of the transactional emails you can send through Office 365 SMTP. &lt;/li&gt;
&lt;li&gt;Integration with custom applications – You can use Office 365 to add email-sending functionality to custom applications and send your users updates, reminders, or other emails specific to your app.&lt;/li&gt;
&lt;li&gt;Scheduling and event reminders – If you’re operating within the Microsoft 365 ecosystem, you can use Office 365 SMTP to send event reminders, schedule appointments, and more.&lt;/li&gt;
&lt;li&gt;Automatic notifications from IoT devices – Besides the standard notifications, you can also leverage Office 365 SMTP to send notifications or alerts from Internet of Things (IoT) devices through email. For example, you can set up your monitoring system to use Office 365 SMTP to notify you when there’s an anomaly. &lt;/li&gt;
&lt;li&gt;Sending emails from different clients with an Office 365 address – Whether you prefer using Thunderbird or Yahoo Mail clients, you can send emails through Office 365 from them. &lt;/li&gt;
&lt;li&gt;Sending emails for small-scale marketing efforts – Although it’s not the most optimal solution for bulk email campaigns as you’ll see later in the article, Office 365 can be used for marketing campaigns with low volume but highly targeted needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to configure Office 365 SMTP server settings?
&lt;/h2&gt;

&lt;p&gt;According to Microsoft’s official documentation, there are three options for configuring Office 365 SMTP server settings. Namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SMTP AUTH client submission – Lets you email anyone both inside or outside an organization and it supports OAuth 2.0, offering a more secure authentication method. Most importantly, it’s easy to configure, making it an ideal choice for sending emails from your application or email client.&lt;/li&gt;
&lt;li&gt;Direct send – Doesn’t let you send emails to external recipients and your messages will be subject to Microsoft’s spam filters. Moreover, emails you send via this option don’t get saved in the Sent Items folder, which can be a big drawback.&lt;/li&gt;
&lt;li&gt;SMTP relay – Setting up an SMTP relay in Office 365 is the most complex of the three options as it requires configuring a connector in Office 365 and managing static IP addresses or certificates. Like Direct send, SMTP relay also doesn’t support modern authentication methods like OAuth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, especially if you’re a developer looking to add email-sending functionality to your application, SMTP AUTH client submission more or less takes the cake. 🎂&lt;/p&gt;

&lt;p&gt;Now, let me show you how to configure it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1. Verify and enable SMTP AUTH
&lt;/h4&gt;

&lt;p&gt;First things first, we need to enable SMTP AUTH on your mailbox to send emails through Office 365 SMTP.&lt;/p&gt;

&lt;p&gt;To check if SMTP AUTH is enabled, you can use:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exchange Admin Center (EAC)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Log in to the EAC with your admin account.&lt;br&gt;
Navigate to “Recipients” → “Mailboxes”&lt;br&gt;
Find and select your mailbox.&lt;br&gt;
Check the status of your SMTP AUTH&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PowerShell&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Connect to Exchange Online PowerShell using your admin credentials.&lt;br&gt;
You can also use ‘Connect-ExchangeOnline’ cmdlet&lt;br&gt;
Run the following command to check the SMTP AUTH of your mailbox:&lt;br&gt;
&lt;code&gt;Get-CASMailbox -Identity "user@domain.com" | Format-List SmtpClientAuthenticationDisabled&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If ‘SmtpClientAuthenticationDisabled’ is ‘False’, SMTP AUTH is enabled&lt;br&gt;
If ‘SmtpClientAuthenticationDisabled’ is ‘True’, SMTP AUTH is disabled&lt;br&gt;
Run the following command to enable SMTP AUTH for your mailbox:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Set-CASMailbox -Identity "user@domain.com" -SmtpClientAuthenticationDisabled $false&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Any changes you make either through EAC or PowerShell probably won’t take effect immediately, so you might need to wait a while.&lt;br&gt;
Verifying and enabling SMTP AUTH requires administrative access to your Office 365 account.&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 2. Insert the necessary Office 365 SMTP settings
&lt;/h4&gt;

&lt;p&gt;To send emails via Office 365 SMTP, enter the following settings into your app or email client:&lt;/p&gt;

&lt;p&gt;SMTP server name: smtp.office365.com&lt;br&gt;
SMTP port: Port 587 (recommended) or port 25&lt;br&gt;
TLS/StartTLS: Enabled&lt;br&gt;
Username/email address: &lt;a href="mailto:john.doe@yourcompanyname.com"&gt;john.doe@yourcompanyname.com&lt;/a&gt;&lt;br&gt;
Password: Your Office 365 password&lt;br&gt;
Note: If you have MFA enabled, you’ll need to generate an app password to log in.&lt;/p&gt;
&lt;h2&gt;
  
  
  Configuration examples
&lt;/h2&gt;

&lt;p&gt;Now that you’re familiar with Office 365 SMTP and know how to configure it, let’s see some actionable examples in WordPress, PHP, and Thunderbird.&lt;/p&gt;
&lt;h3&gt;
  
  
  WordPress Office 365 SMTP settings
&lt;/h3&gt;

&lt;p&gt;If you’re a WordPress user, you can configure the Office 365 SMTP with plugins like WP Mail SMTP or Post SMTP for instance.&lt;/p&gt;

&lt;p&gt;All you have to do is:&lt;/p&gt;

&lt;p&gt;Sign in to your WordPress account&lt;br&gt;
Install a plugin (I used WP Mail SMTP in this example)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3hc4yqswb9nxeth8c19.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3hc4yqswb9nxeth8c19.png" alt="Image description" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to WP Mail SMTP → Settings&lt;br&gt;
Choose ‘Other SMTP’ as the mailer&lt;br&gt;
Enter the Office 365 settings&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F753ra1pdqimmwjzba579.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F753ra1pdqimmwjzba579.png" alt="Image description" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  PHP
&lt;/h3&gt;

&lt;p&gt;When it comes to PHP, you have several email-sending libraries to choose from. In this example, I’ll use Symfony because of its practicality.&lt;/p&gt;

&lt;p&gt;Here’s a code snippet you can modify with your Office 365 credentials to send emails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

use Symfony\Component\Mailer\Mailer; 
use Symfony\Component\Mailer\Transport\Smtp\SmtpTransport; 
use Symfony\Component\Mime\Email;

require_once './vendor/autoload.php';


$transport = (new Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
('smtp.server.com', 587))
                -&amp;gt;setUsername('username')
                -&amp;gt;setPassword('password');

$mailer = new Mailer($transport); 

$email = (new Email())
            -&amp;gt;from('hello@registered.com')
            -&amp;gt;to('you@example.com')
            -&amp;gt;subject('Time for Symfony Mailer!')
            -&amp;gt;text('Sending emails is fun again!')
            -&amp;gt;html('&amp;lt;p&amp;gt;See Twig integration for better HTML integration!&amp;lt;/p&amp;gt;');

$mailer-&amp;gt;send($email);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Thunderbird
&lt;/h3&gt;

&lt;p&gt;As I’ve previously mentioned, besides custom applications, you can also set up email clients like Thunderbird to send emails through Office 365 SMTP.&lt;/p&gt;

&lt;p&gt;Here’s how you can do it:&lt;/p&gt;

&lt;p&gt;Open the Thunderbird email client&lt;br&gt;
Click on ‘Account Settings’ in the upper-right corner of the window&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffw9tldbzmunawocn3p9u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffw9tldbzmunawocn3p9u.png" alt="Image description" width="800" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select ‘Outgoing Server (SMTP)’ at the bottom of the drop-down menu&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fycszepaasmddtpgs6x0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fycszepaasmddtpgs6x0t.png" alt="Image description" width="350" height="756"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter your Office 365 settings&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8grndouf0jmf053tr1qu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8grndouf0jmf053tr1qu.png" alt="Image description" width="674" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep in mind that I’ve used Thunderbird version 115.0 in this example, so there might be differences in your access to ‘Account Settings’ if you’re using an older version of the client.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to configure Office 365 POP3 settings?
&lt;/h2&gt;

&lt;p&gt;Once you’ve configured your Office 365 SMTP, you’ll need an ”email retrieval” or “pull protocol” for fetching messages from the server. One of such protocols is Post Office Protocol 3, or POP3 for friends.&lt;/p&gt;

&lt;p&gt;POP3 lets you download messages from your Office 365 account to your local device. It can be useful if you have a limited connection and want to view your messages offline or if you want to create a backup of emails by storing them locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Office 365 POP3 settings
&lt;/h3&gt;

&lt;p&gt;To use Office POP3, insert these settings into your app configuration or email client:&lt;/p&gt;

&lt;p&gt;Server name: outlook.office365.com&lt;br&gt;
Port: 995&lt;br&gt;
TLS/StartTLS: Enabled&lt;br&gt;
Username/email address: &lt;a href="mailto:john.doe@yourcompanyname.com"&gt;john.doe@yourcompanyname.com&lt;/a&gt;&lt;br&gt;
Password: Your Office 365 password&lt;/p&gt;

&lt;h2&gt;
  
  
  How to configure Office 365 IMAP settings?
&lt;/h2&gt;

&lt;p&gt;Another pull protocol you can use to retrieve your emails is IMAP or Internet Message Access Protocol.&lt;/p&gt;

&lt;p&gt;IMAP is considered by many a more convenient protocol than POP3 as it synchronizes your emails across your devices. It stores them on the email server, where you can manage, open, view, and delete your messages. In essence, IMAP works similarly to cloud email.&lt;/p&gt;

&lt;h3&gt;
  
  
  Office 365 IMAP settings
&lt;/h3&gt;

&lt;p&gt;To use Office 365 IMAP, you’ll need the following settings:&lt;/p&gt;

&lt;p&gt;Server name: smtp.office365.com&lt;br&gt;
Port: 993&lt;br&gt;
TLS/StartTLS: Enabled&lt;br&gt;
Username/email address: &lt;a href="mailto:john.doe@yourcompanyname.com"&gt;john.doe@yourcompanyname.com&lt;/a&gt;&lt;br&gt;
Password: Your Office 365 password&lt;/p&gt;

&lt;h2&gt;
  
  
  POP3 vs IMAP – which one is better?
&lt;/h2&gt;

&lt;p&gt;Simply put, POP3 and IMAP serve different purposes and fit different personal needs, so we can’t really say one is better than the other.&lt;/p&gt;

&lt;p&gt;However, most users nowadays could benefit more from IMAP as we use different devices to fetch our emails. And as mobile networks have become more affordable and Wi-Fi is everywhere, the synchronization IMAP offers can really go a long way.&lt;/p&gt;

&lt;p&gt;Moreover, IMAP is the default protocol for the majority of modern email clients.&lt;/p&gt;

&lt;p&gt;But, whether you want to store your emails on your local devices for security reasons or for convenience’s sake, POP3 is the way to go for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting Microsoft Office 365 SMTP server configuration
&lt;/h2&gt;

&lt;p&gt;I’ve scoured the community forums for the most common Microsoft Office 365 errors so you don’t have to, and here are some of the most common ones:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;System.Net.Sockets.SocketException (0x80004005)&lt;/strong&gt;&lt;br&gt;
This error message means that you either don’t meet SMTP AUTH requirements or your network firewall or Internet Service Provider (IDP) are blocking ports 587 or 25.&lt;/p&gt;

&lt;p&gt;In case you meet the requirements, here’s how you can check if you’re potentially getting blocked:&lt;/p&gt;

&lt;p&gt;Open Command Prompt (CMD) as an administrator&lt;br&gt;
Type ‘telnet’ to run telnet&lt;br&gt;
Run the following command:&lt;br&gt;
open smtp.office365.com 587(25)&lt;br&gt;
If you’re able to successfully connect, you will receive a response line similar to:&lt;/p&gt;

&lt;p&gt;220 BY1PR10CA0041.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 1 Jun 2024 12:00:00 +0000&lt;br&gt;
In case you can’t connect, try disabling your firewall or contacting your ISP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SMTP send error. The operation has timed out&lt;/strong&gt;&lt;br&gt;
Although a common error, this error is likely caused either by your antivirus software or firewall blocking your SMTP connection or a typo in your Office 365 settings. If neither of these solutions works, then the issue is probably on Microsoft’s end, in which case you’ll need to contact their support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.7.60 SMTP; Client does not have permissions to send as this sender.&lt;/strong&gt;&lt;br&gt;
If you’re seeing this error, check whether your application or email client is trying to send emails from a different address than the one you’ve entered in your SMTP configuration. The two need to be the same for the sending to work.&lt;/p&gt;

&lt;p&gt;But, you can also give the ‘Send As’ permission to another address if you plan to use two different addresses for email sending.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transport Layer Security (TLS) encryption related errors&lt;/strong&gt;&lt;br&gt;
Recently, Microsoft has started rejecting connections to smtp.office365.com that use TLS1.0/1.1 for SMTP AUTH. So, make sure your device supports TLS version 1.2 or above.&lt;/p&gt;

&lt;p&gt;But, if you need to use older versions of TLS for legacy clients and devices, you can:&lt;/p&gt;

&lt;p&gt;Go to Settings in your Exchange admin center&lt;br&gt;
Navigate to Mail Flow (under Security)&lt;br&gt;
Check “Turn on use of legacy TLS clients)&lt;br&gt;
Click “Save”&lt;br&gt;
For more information on Office 365 and TLS, read the official Microsoft’s article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Office 365 SMTP limitations or when not to use Microsoft
&lt;/h2&gt;

&lt;p&gt;Office as an SMTP server&lt;br&gt;
While Office 365 does offer a reliable SMTP server, it has some considerable limitations that you should go over before deciding on it as your go-to option.&lt;/p&gt;

&lt;p&gt;Namely, they include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monthly subscription fees – To have access to Office 365 SMTP server, you’ll need to pay a monthly subscription. It has several pricing plans, with the basic one starting at  $6.99 per month and allowing you to send emails to up to 10,000 recipients per day.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s important to note that 10,000 recipients per day is not the same as sending 10,000 emails per day. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No support for bulk email sending – Office 365 SMTP is not the most ideal option for sending large amounts of emails as the sending limit is the same for all pricing tiers. This means that even if you pay for Enterprise E3/E5 (the most expensive plan), you will still be limited to 10,000 recipients per day and 30 messages per minute, which can be a considerable issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re looking for a bulk-sending alternative, here’s an in-depth article on the top 10 mass email service providers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lack of monitoring features – Typically, most SMTP service providers offer in-depth analytics and reporting features, which can help you optimize your campaign and improve your email deliverability. Unfortunately, this isn’t the case with Office 365.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Steep learning curve – Getting the hang of Office 365 can be quite a challenge as it’s not the most user-friendly SMTP service out there. Add to this the wide range of features and services offered by the whole suite, and you’ll realize why most new users may even need training to navigate Office 365 complexities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Consider an alternative — using Mailtrap Email Sending
&lt;/h2&gt;

&lt;p&gt;If you’re like me and Office 365 SMTP limitations are too much for you, don’t worry—I have just the right solution.&lt;/p&gt;

&lt;p&gt;I use Mailtrap, an Email Delivery Platform for developer teams to test, send, and control their email infrastructure in one place. &lt;/p&gt;

&lt;p&gt;Personally, I needed to send bulk mail, so I used Mailtrap’s Bulk Stream to send large amounts of marketing and promotional emails in my high-volume campaigns to enhance my deliverability even further.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lpwhizje5ix3azuy3q6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lpwhizje5ix3azuy3q6.png" alt="Image description" width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, I use Mailtrap’s detailed analytics to check my bounce rates, open rates, click-through rates and other useful stats. This allows me to keep track of my email infrastructure and optimize it accordingly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4l9jt7mxagq9i09ar2u1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4l9jt7mxagq9i09ar2u1.png" alt="Image description" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mailtrap Email Sending also provides me with deliverability alerts every Monday to let me know how my emails are doing in the form of in-depth stats and I also get hourly alerts when a critical metric goes below a predetermined threshold.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpoy3yoxuyt8797n6nwm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpoy3yoxuyt8797n6nwm.png" alt="Image description" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As enhancing my deliverability goes, I make sure to test my emails before sending them out, a part of the email-sending process that goes with it like salt goes with pepper. 🧂&lt;/p&gt;

&lt;p&gt;Without testing my emails, I risk having them being marked as spam, or, worst case scenario: their HTML template getting poorly rendered by certain web browsers.&lt;/p&gt;

&lt;p&gt;Mailtrap Email Testing, a part of the Mailtrap Email Delivery Platform lets me check my spam score, inspect and verify my HTML/CSS and make sure it’s pitch-perfect before it reaches my recipients’ inboxes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw3euh5kdlaqbnqrtfeo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw3euh5kdlaqbnqrtfeo.jpg" alt="Image description" width="800" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, and perhaps most importantly, Mailtrap is super easy to use.&lt;/p&gt;

&lt;p&gt;Check it out:&lt;/p&gt;

&lt;p&gt;Register an account on Mailtrap.&lt;br&gt;
Add and verify your domain under ‘Sending Domains’&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmo4hd72w6b4u5u5nydj1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmo4hd72w6b4u5u5nydj1.png" alt="Image description" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the ‘SMTP/API Settings’ tab and choose your preferred SMTP stream.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8y2wcg3ohs3vpabz4391.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8y2wcg3ohs3vpabz4391.png" alt="Image description" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the SMTP settings provided by Mailtrap to integrate the functionality within your custom application or email client.&lt;br&gt;
Make sure everything is configured and works correctly by sending a test email.&lt;/p&gt;

&lt;p&gt;We appreciate the you chose this article to find out how to set up Office 365. If you want to find more interesting content on related topics, follow &lt;a href="https://mailtrap.io/blog/office-365-smtp/"&gt;Mailtrap blog&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>smtp</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
