wanderors
wanderors

Reputation: 2292

Can we add images into outlook mail using php?

I have a Create task page. So once Task is created, and if user admin clicks mail button. Outlook will open and add the subject and body which I typed.

But my doubt is can I add an image and also can we change teh font color in Message using code itself. I am a newbie in this thats why the dumb doubt.

<a href="mailto:[email protected]?subject=Any Subject&body= Any Topics">Mail</a>>

Upvotes: 0

Views: 1353

Answers (2)

user1288654
user1288654

Reputation:

First of all, every email client application works differently. Second, You can't change the subject font. As for adding images on the e-mail, you must attach headers to the mail being sent, indicating it contains html data. Then you must add the image itself either as an attached file or adding the html img tag on the mail body. I'd rather use the php mail() function, but you have here and here some specifications to work with mailto, which is rather obscene.

Upvotes: 0

Starx
Starx

Reputation: 78981

Outlook is just an email application, which shows email as it appears.

There is no such thing as Outlook Compatible email.

You should provide direct link to images where you are sending a HTML email. Here is simple example of doing this using native mail()[docs] function.

<?php
$subject = 'Email with image';
$message = '
    <html>
    <head>
      <title>Email with image</title>
    </head>
    <body>
      <p><img src="http://mydomain.com/direct/link/toimage.jpg" /></p>
    </body>
    </html>';

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
//..................

mail($to, $subject, $message, $headers);

Upvotes: 1

Related Questions