PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Simple PHP Mail Script

<?php

    $to = '[email protected]';
    $subject = 'PHP mail test';
    $message = 'This is body of email';
    $from = "From: FirstName LastName <[email protected]>";
    mail($to,$subject,$message,$from);

?>

This is a simple PHP mail script. Usually I use it for testing purposes.

Copy and paste this into a test-mail.php file:

<?php 
    $to = '[email protected]';
    $subject = 'PHP mail test';
    $message = 'This is body of email';
    $from = "From: FirstName LastName <[email protected]>";
    mail($to,$subject,$message,$from);
?>

Then to run the script just run:

php test-mail.php

This is very useful for testing this on a Linux machine, so if you need to send a few emails you can do something like this:

for i in {1..3}; do php test-mail.php; done

This would run the test PHP script 3 times.

BETA Snippet explanation automatically generated by OpenAI:

No explanation generated yet.

Snippet By Dev Dojo

ยท

Created June 12th, 2021

ยท

Report Snippet