/    Sign up×
Community /Pin to ProfileBookmark

PHP MIME Embedded Image/HREF

I have created a simple form that will get a “subject” and “message” that I type in and send it. I can get it to send attachments, but can not get embedded images to work, or hyperlinks. When I check the received email and look at the link properties, it says the name of my email provider and then the link rather than the absolute address of the link. Images just come as an X and links come up as nothing. Any ideas? Is there a way to tell it not to read whatever it is that the clients email reader is putting infront of it? Thanks for any help.

[code=php]
<?php #10
include(“Vars.php”);
$email = $_REQUEST[’email’];
$connection = mysql_connect($host, $user, $passwd)
or die (“getSQL mysql_connect ($host, $user, $passwd)” . mysql_error ());
$db = mysql_select_db($database)
or die (“Couldn’t select database.”);
if($submit==”Send”)
{
require_once ‘MIME.php’;
$report = mysql_query(“SELECT * FROM email_address”); #20
while($row = mysql_fetch_array($report))
{
$to = $row[’email’];
$id = MIME::unique(); // get ID value (random) for the embed image
$subject = $_REQUEST[‘subject’];
$themessage = $_REQUEST[‘message’];
$message = $themessage;
$text = MIME::message(‘Text version of message.’, ‘text/plain’); // set text/plain version of message
$html = MIME::message($message, ‘text/html’); // set text/html version of message
//$at[] = MIME::message(‘source file’, ‘text/plain’, ‘file.txt’, ‘ISO-8859-1’, ‘base64’, ‘attachment’); // add attachment with name ‘file.txt’
$file = ‘xpertmailer.gif’; // add inline attachment ‘$file’ with name ‘XPM.gif’ and ID ‘$id’
$at[] = MIME::message(file_get_contents($file), FUNC::mime_type($file), ‘XPM.gif’, null, ‘base64’, ‘inline’, $id);
$mess = MIME::compose($text, $html, $at); // compose mail message in MIME format
$send = mail($to, $subject, $mess[‘content’], ‘From: [email protected]’.”n”.$mess[‘header’]);
}
};
?>
[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @SVDuke13 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...