bulk email send phpmailer code example
Example 1: sendgrid nodejs send email template
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: '[email protected]',
from: '[email protected]',
templateId: 'd-f43daeeaef504760851f727007e0b5d0',
dynamic_template_data: {
subject: 'Testing Templates',
name: 'Some One',
city: 'Denver',
},
};
sgMail.send(msg);
Example 2: how to send email with php
<?php
var Name = $_POST('name');
// grabbing the data from the form when posted
// make sure to add name="name" or name="email"
// in the input tag to grab the the specific elements
// data example <textarea name="message"> or
// <input type="number name="number">
var Email = $_POST('email');
var Number = $_POST('number');
$to_email = 'Your E-mail';
$subject = 'The Subject of the message';
$message = 'Name'.$name. "email" .$email. "number:" .$number.".";
$headers = 'From: noreply @ company . com'; //optional
mail($to_email,$subject,$message,$headers);
?>