Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //require sendgrid
- require "sendgrid/sendgrid-php.php";
- //sendMail function
- function sendMail($to, $subject, $content, $from){
- //init sendgrid and email
- $sendgrid = new SendGrid("my_username", "my_password");
- $email = new SendGridEmail();
- //to address = individual or array
- if (is_array($to)) $email->setTos($to);
- else $email->addTo($to);
- //from, subject, contet
- $email->setFrom($from)->
- setSubject($subject)->
- setHtml($content);
- //send email
- $sendgrid->send($email);
- }
- sendMail("to@example.com", "Subject", "Content", "from@example.com");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement