sorry for the question, but I have an mailing system from a Laravel app that sends a newsletter in HTML format with images on it. I tested by placing the html in blade and embedding the images like this:
<?php $message->embed(storage_path().'/images/unnamed.jpg'); ?>
Because if I just referenced the location of the image when the html is sent to mail all I'm getting are broken images. However, when I embed the images the mail is incorrect because the images are in different places instead of where they should be. What is the correct way of doing this? Instead of embedding the image should I store it on a cloud storage and just reference it from the html?
Please help, appreciate any advice, solution, or pointers. Thank you very much.
Here is the sample email:
You're getting broken images because it's an external (internet) link to the image. There is no proper way of embedding an image. Every external request is a potential danger and it's block by default by mailing/anti-virus program. The only way to show a picture is to ebed an image directly into HTML. here's an example:
http://www.techerator.com/2011/12/how-to-embed-images-directly-into-your-html/
Related
I have a sign-up form. When someone signs up, they immediately receive an email (in HTML format) with the following information:
1) Their sign-up information (Name, P#, Email, etc.)
What I need is the following:
1) After sign-up, in the email the user receives, there needs to be a png-image that is generated by an external script. At the moment, I am using PEAR to generate/send the email (AOK) and Mail_Mime::addHTMLImage() to add the image, but alas, with no luck. All I get when I send the email is a broken image with my alt text appearing. It's important to keep in mind that I am generating the image (to be used in the HTML email) from an external script.
The code I'm using to try and grab the image (from the external script) is as follows:
$mime->addHTMLImage(get_template_directory_uri()."/qr_code_generator.php?code=", "image/png");
Also, not sure if it helps, but I'm using http://phpqrcode.sourceforge.net/ for the QR code generation
Any and all help is greatly appreciated!
I answered most of this in your previous question here.
The likely issue again is that you can't embedded base64 encoded images directly into the body of the email, you have to treat them like attachments. The way you do that is with a content section and an appropriate content id.
Check out the documentation for the addHTMLImage method.
https://pear.php.net/manual/en/package.mail.mail-mime.addhtmlimage.php
It's not the best documentation but check it out and my other answer. That should give you enough to solve the issue.
I was looking at an possibly fraudulent eBay auction. However I am confused by an image within it, since it does not appear to be an image.
youneedtobuy.intothis.org/win.php
The complete HTML content of the url above is:
<body>
<img src="http://youneedtobuy.intothis.org/win.php" >
</body>
Here is a screen copy of the image, with the email address blurred out by me. There is no JS scripting, no CSS to speak of, just one line of code.
So, essentially the scammer can insert an 'image' into their eBay ad, and that image won't be scanned by normal tools.
How is this image created? And how could the friendly folks at ebay include a scanner in their system that has the ability to "see" this image (and preclude the scam from re-occurring?)
The image is likely created using PHP's file_get_contents() function. For example, the following PHP script will display the contents of myimage.jpg to the browser, but the file could be called show-image.php:
<?php
header("Content-Type: image/jpeg");
header("Content-Length: ".(string)(filesize('myimage.jpg')));
echo file_get_contents('myimage.jpg');
?>
As you can see, this is achieved by telling PHP to serve up the image/jpeg MIME type.
Any image can be returned by a script instead of a real file.
An alternative answer shows methods of doing this, but by using a script one can serve different images to different users, log IP address and other information thus tracking viewers etc.
It is also a common technique used to return thumbnail or summary images. e.g. using PHP and ImageMagick to generate an image of the first page of a PDF file.
Incidentally the image will be scanned by normal tools - they simply look for the image tags, not what extension the file has. What you are really saying is that the text contained within the image won't be processed or analysed, and the image does invite you to directly connect to someone, which is against eBays terms and conditions.
I've been creating a page where I can send some info with an image to a yahoo account. I'm using CKeditor and php mail. Is there a way to do it? Actually I've tried it and it works good but the image is blank only the border size of the image is visible. Thanks
Assuming that you are not embedding the images to the email, most likely your URL is wrong. Try post-processing the URLs to be absolute and not relative and that will fix your problem.
I am trying to send email as html with embedded images (not attachment) and as background.
I was trying to use Xpert Mailer but their documantion has small amount of information so I didnt succeed.
I was also trying to use Swiftmailer, with Swiftmailer I succeed to send email with embedded images but not as background.
Anyone has any clue how to send embbed images as background / has good PHP Email Sender?
Thanks!
Don't know about the apps you're using but this can be done by embedding the images in base64 format, looks like this:
<img src="data:image/gif;base64,R0lGODlhUAABLABLAMOREBASE64HERE">
Quick google search shows the following converter site: click
I found the answer. the problem was not my html or how I embedded the image. tha problem was that gmail doesnt support css property background / background-image and therefore it didnt work for me.
I had to use
How should i create a preview of image to be uploaded before it is actually submitted using AJAX in PHP?
Without uploading the image, this is going to be impossible in JavaScript as far as I can see, because security limitations are going to prevent you from determining the selected file in the file upload, and embedding that file in an img tag (as it used to be possible five years ago.)
You will be more lucky with Flash-based uploaders. I have seen some that offer the kind of functionality you want.
Update: Here's one that offers a preview function. From what I can see, it base64 encodes the local image and serves it to the surrounding HTML page as a inline data <img> tag. This is great because it might integrate well into your site. It does not work with any version of Internet Explorer, though.
Here's a fully Flash based solution that does previews in all browsers.
you first have to upload the document to server. Than you can show like.
<img src="uploads/file1_12224.jpg" />
The "file" input type doesn't expose the local file location of the file to be uploaded. It does "appear" to because as a user you can see the location, but the web page never knows this value. Without the local file address, you can't show a preview of the image on the web page using plain HTML or JavaScript.