How do I turn an image (lets say a logo) into a character... I don't want images filtered out because of the email providers (Gmail, Yahoo, etc.).... So I want them to always show up...

Dani AI

Generated

was right to point toward embedding; since @<M/> asked about PHP, the practical way is to send the logo as an inline attachment (a multipart/related message) and reference it from the HTML with a Content-ID (CID). This avoids an external fetch that some webmail clients block, but it is not a guaranteed bypass—clients or spam filters can still hide attachments. Always include a plain-text alternative and good alt text so the message is usable without images.

Key points to follow: build a multipart/related message where the HTML part contains <img src="cid:your_logo_cid" alt="Logo">, and the image part has headers like Content-Type: image/png; name="logo.png", Content-Transfer-Encoding: base64, Content-Disposition: inline, and Content-ID: <your_logo_cid> (note the angle brackets in the header; the HTML src uses cid:your_logo_cid without brackets). Keep embedded images small (to avoid large message size), prefer PNG or optimized GIF, and avoid CSS background images or data-URIs for broad client compatibility. Also ensure SPF/DKIM are set so messages are less likely to be marked suspicious.

A reliable shortcut is to use a library (PHPMailer or similar). Example with PHPMailer:

use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';

$mail = new PHPMailer(true);
$mail->isSMTP(); // configure SMTP as needed
$mail->setFrom('from@example.com','Sender');
$mail->addAddress('to@example.com');
$mail->isHTML(true);
$mail->Subject = 'Logo test';
$mail->Body = '<html><body><img src="cid:logo_cid" alt="Logo"></body></html>';
$mail->addEmbeddedImage('/path/to/logo.png','logo_cid','logo.png');
$mail->send();

See PHPMailer for details and options: (https://github.com/PHPMailer/PHPMailer).

Recommended Answers

All 4 Replies

Rather than referencing a link in your email, what you want to do is embed the images. The approach depends on the server side scripting language you are using.

Okay, so how would I embed the images?

I have sample code for asp.net/vb. what scripting language are you using?

well... does php count?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.