I want to harden my SPF setting.
However I have trouble testing my SPF setting.
I want to be able send a test email to try out my new SPF settings.
Most of the resource on internet seems to be use a similar php script, which looks something like this:
<?php $to = 'email@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: firstname.lastname@example.org' . "\r\n"; mail($to, $subject, $message, $headers); ?>
(The above comes from the website here: https://dylan.tweney.com/2017/10/25/how-to-fake-an-email-from-almost-anyone-in-under-5-minutes/)
I am not familiar with php at all. When I run it on my macbookpro, it throws this error:
Parse error: syntax error, unexpected '$subject' (T_VARIABLE) in /Users/antkong/myproject/_test_mail/test.php on line 5
Here is the command:
php -n -f test.php
and the version of my php run time is
$ php -version PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
What do I need to run this php script successfully?
I don't need to stick to php. I am happy to use other language such as python. I wonder if there is a counterpart of the php script above written in python or other language which is easier to set up and run?