If I want to use Swiftmailer to send a newsletter and I build the look of the newsletter as a php page. How should I include this in the code?
I think I did it like this before:
I have all the From, To, Sender aso there as well.
But the code doesn’t seem to include my page in the body when trying to send.
Is there another way to do this or a better way that will work?
What’s the value of $webmail immediately after the call to file_get_contents? Check to make sure it’s what you expect. Also, what exactly is in the body of the email that you receive?
Nope. Those three lines you posted look fine, which means there’s something else in play that’s causing the problem.
Well, the content that is written after file_get_contents is a web page and it looks fine on screen.
In the e-mail I get nothing. Just a blank e-mail. But, when I tried to send it to Mac Mail I could see that the beginning of the text was listed in the preview field. Something like the image below:
There are possible reasons why that call might fail, yes. Which is why I suggested that you check the value of $webmail immediately after the call to file_get_contents. Make sure the call succeeded and that you got the value you were expecting.
Any chance that the emails you’re checking with disallow HTML? Some email services will allow you to view the email’s source. Try that and see if the HTML is in there.