General_Twyckenham
General_Twyckenham

Reputation: 2261

Sending an image with text overlay in email

I'm using PHPMailer to send emails with images embedded in the email.

I'm just wondering what the best way to achieve the following usecase is:

Sending an image (like a picture of a gift card) with text overlaying it. Some of the text is standard on each email, other text is variable (like Gift Card code, and amount of gift card).

For styling, I'm obviously using tables and colspans, and all that fun stuff we are forced to use for HTML emails, but since I want the image to be a certain width (approximately 400px, or a bit more than half the width of a standard email window) and I also want the text to fit on the image, I'm wondering what the best way to ensure that the text doesn't escape the boundary of the image is.

Any advice would be appreciated.

Upvotes: 0

Views: 443

Answers (1)

K.A.F.
K.A.F.

Reputation: 2337

Since you're already using tables, set your image as the background for a table cell and put the text inside the cell. You can keep the text inside your arbitrary picture border by setting the padding of the cell.

Upvotes: 1

Related Questions