I have a page that uses phpmailer() to send emails. Works great. Does everything I need. And I need to do a if else statement inside the echo of $body
This is the code I'd like to run. By itself it works fine
<?php
$url = "http://www.example.com/problem_pic.jpg";
$file_headers = @get_headers($url);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
echo '';
} else {
echo "Here is a picture of the problem<br>";
echo "<td><a href='$url'>Problem Pic</a></td>";
}
?>
But I wanted it used within a echo
Example of the code of what I'm doing with phpmailer
$mail->AddAddress = "user@somedomain.com";
$mail->Body = "
<html>
<body>
Hello $user,<br>
Here is some information on the problem<br><br>
$problem<br>
##Here is where I need the if else statement to insert the picture if there is one
<br>
If you have any questions please let me know<br>
Thanks,<br>
Admin";
I can't figure out how to get that if else statement to work inside my echo.
Is there anything I'm missing? Or am I over thinking this?
Let me know
TIA
Sean