3

here is my code to send an email:

$result = $client->sendEmail([
    'Message' => [
        'Body' => [
            'Html' => [
                'Data' => '<string>', // PUT HTML FILE HERE
            ],
            'Text' => [
                'Data' => '<string>',
            ],
        ]
    ]
]);

I have a template.php file which is the email template. i don't want to paste it in the html data because it is too long and it looks unorganized. how can i get the contents of http://www.example.com/template.php in the Html Data field using a link or url?

1 Answer 1

2

You can get contents of http://www.example.com/template.php by file_get_contents

$result = $client->sendEmail([
    'Message' => [
        'Body' => [
            'Html' => [
                'Data' => file_get_contents('http://www.example.com/template.php'),
            ],
            'Text' => [
                'Data' => '<string>',
            ],
        ]
    ]
]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.