afftrack-helper 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of afftrack-helper might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +48 -0
  2. package/package.json +14 -0
  3. package/test/index.js +6 -0
package/index.js ADDED
@@ -0,0 +1,48 @@
1
+ //index.js
2
+ const nodemailer = require('nodemailer');
3
+
4
+ // Function to send an email
5
+ const sendEmail = async (to, subject, body) => {
6
+ try {
7
+ // Create a transporter with SMTP configuration
8
+ const transporter = nodemailer.createTransport({
9
+ host: 'sandbox.smtp.mailtrap.io',
10
+ port: 2525,
11
+ secure: false,
12
+ auth: {
13
+ user: 'fb018dcc91de2e',
14
+ pass: 'd17c6e0fb4d998',
15
+ },
16
+ });
17
+
18
+ // Define email options
19
+ const mailOptions = {
20
+ from: 'dolan.chowdhury@codeclouds.in',
21
+ to,
22
+ subject,
23
+ text: body,
24
+ };
25
+
26
+ // Send the email
27
+ const info = await transporter.sendMail(mailOptions);
28
+ console.log('Email sent:', info.messageId);
29
+ } catch (error) {
30
+ console.error('Error sending email:', error);
31
+ }
32
+ };
33
+
34
+ function addition(a,b) {
35
+ return a + b;
36
+ }
37
+ function multiply(a,b) {
38
+ return a * b;
39
+ }
40
+ function test() {
41
+ return "Hi! Welcome to test helper.";
42
+ }
43
+ module.exports = {
44
+ test,
45
+ addition,
46
+ multiply,
47
+ sendEmail
48
+ };
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "afftrack-helper",
3
+ "version": "1.0.1",
4
+ "description": "affialate tracking helper",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Dolan Chowdhury",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "nodemailer": "^6.9.3"
13
+ }
14
+ }
package/test/index.js ADDED
@@ -0,0 +1,6 @@
1
+ const { sendEmail } = require('..');
2
+ console.log("Test Email");
3
+ // Usage example
4
+ sendEmail('dd15@mailinator.com', 'Test Email', 'This is a test email.')
5
+ .then(() => console.log('Email sent successfully.'))
6
+ .catch((error) => console.error('Error sending email:', error));