0

hello,
i tried with below code but its not working for me.
I am send it to gmail.

is there anything which i have missed out?

$subject = "Happy Work Anniversary !" ;
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$link = public_path() . "/images/Work_Anniversary.png" ;
$comment = View::make('EmailNotifications/BirthdayEmail');
mail("abc@gmail.com", $subject, $comment, $headers);

and in view i have used

<html>
<body>
Hello <?php echo $employee_name; ?>,<br>
<img src='<?php echo $link?>'>
<br>
path used is <? echo $link ?>
<br><br>
<br><br>Thanks,<br>
GS Lab
<br><br>
</body>

</html>

in gmail, it shows broken link.

3
Contributors
8
Replies
32
Views
2 Years
Discussion Span
Last Post by pritaeas
0

I tried,
but it gives very diffrent path.
it is of something google's

0

it gived me "/var/www/ABCD/public/" and i have attached "/images/abc.png"
with is nothing but whole path where my image file is located.

1

In addition, if you're using Laravel, then you can use the asset() helper:

$link = asset("/images/Work_Anniversary.png");

This will prepend the application url.

0

Hello cereal,
You are right, am using laravel!

I also tried with your solution

<body>
Hello <?php echo $employee_name; ?>,<br>
<img src='<?php echo $link;?>'>
path used is <? echo $link ?>
</body>

path used gives me proper path of local host.
but image is not iserting in email.

what are the other changes which am missing?

1

You cannot access localhost from outside, because it always points to the machine it's on. You can only make this work if the image is on an accessible server, either by IP address or by domain name.

The other way would be to embed the image into the e-mail, for that I suggest you search the forum. There are examples to be found.

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.