Sendmail: linking to an image


SUBMITTED BY: Guest

DATE: Nov. 5, 2019, 5:29 p.m.

FORMAT: Text only

SIZE: 4.6 kB

HITS: 391

  1. Sendmail: linking to an image
  2. I don't use sendmail a lot, and I can't quite remember how to make this work right. I'm trying to send an email to an admin when a user submits a form, and I want to link to an image if they submitted one.
  3. ++++++++++++++
  4. list of top cheapest host http://Listfreetop.pw
  5. Top 200 best traffic exchange sites http://Listfreetop.pw/surf
  6. free link exchange sites list http://Listfreetop.pw/links
  7. list of top ptc sites
  8. list of top ptp sites
  9. Listfreetop.pw
  10. Listfreetop.pw
  11. +++++++++++++++
  12. But in Outlook, the link is removing the first 2 characters of the link. So when I send:
  13. <img src="https://www.example.com/image.jpg">
  14. Outlook is getting:
  15. <img src=ttps://www.example.com/image.jpg">
  16. But it works fine in Thunderbird.
  17. I'm coding in Perl, but I put it here because I think it's really a sendmail question:
  18. # set $mailprog, $username, $subject, and $boundary
  19. $img = "<img src='https://www.example.com/$pic'>";
  20. open(MAIL,"|$mailprog -t");
  21. print MAIL <<EOF;
  22. To: admin\@example.com
  23. From: $username
  24. Subject: $subject
  25. MIME-Version: 1.0
  26. Content-Type: multipart/alternative;
  27. boundary="$boundary"
  28. This is a multi-part message in MIME format.
  29. --$boundary
  30. Content-Type: text/plain;
  31. charset="iso-8859-1"
  32. Content-Transfer-Encoding: quoted-printable
  33. (blah blah blah)
  34. --$boundary
  35. Content-Type: text/html;
  36. charset="iso-8859-1"
  37. Content-Transfer-Encoding: quoted-printable
  38. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
  39. fullonsurf.com
  40. host havoc login
  41. traffichoopla.com
  42. fit2gym.com
  43. i host poker
  44. make money hand over fist
  45. tgmi3a.com
  46. redrocketsurf.com
  47. buxcap.com
  48. <font face=Arial>
  49. (blah blah blah)
  50. $img
  51. </font>
  52. --$boundary--
  53. EOF
  54. close MAIL;
  55. I have the same problem if I change the <img src...> tag to <a href...>. The problem is always following the =.
  56. What's the correct way to code this?
  57. perhaps outlook is trying to remove images and it gets munged in the process.
  58. you might try embedding a base64 encoded image in the body of the email and modify the src to appropriately refer to that image.
  59. this is merely a shot in the dark, but try using the qq quoting operator and double quotes for the attribute value to see if that fixes anything:
  60. $img = qq(<img src="https://www.example.com/$pic">);
  61. Well, it looks like the problem is any link, not just an image link :-( The <a href...> link is messing up, too. So this:
  62. <a href="https://www.example.com/view.php?id=csdude">https://www.example.com/view.php?id=csdude</a>
  63. becomes:
  64. <a href=ttps://www.example.com/view.php?id=dude">https://www.example.com/view.php?id=dude</a>
  65. (removing the next 2 digits after both equal signs)
  66. The code I'm using here, based on your suggestion with qq():
  67. use URI::Escape;
  68. $uri_user = uri_escape($username);
  69. $link = qq($home/view.php?id=$uri_user);
  70. Just for ### and giggles: What happens if you sneak in a couple of extra spaces--or, I guess, a couple of non-space characters--between the = sign and the "http ? (And, I guess, slip in two bogus leading characters at the front of each parameter value.)
  71. Something is niggling at the edge of my mind and I'm trying to lure it in closer.
  72. Well, it looks like the problem is any link, not just an image link :-( The <a href...> link is messing up,
  73. indeed i forgot you had mentioned that.
  74. Just for ### and giggles: What happens if you sneak in a couple of extra spaces--or, I guess, a couple of non-space characters--between the = sign and the "http ? (And, I guess, slip in two bogus leading characters at the front of each parameter value.)
  75. Well, then it would break on my Thunderbird! LOL And it currently seems to work fine on both iPhone and Android's email, so I guess that adding characters would make it break on those, too.
  76. This seems to only be a problem for Outlook, but I can't find any reference to it anywhere else. The admin is specifically using Outlook 2007, if that helps?
  77. Wait, I think I found it! The problem is here:
  78. Content-Transfer-Encoding: quoted-printable
  79. QP works by using the equals sign = as an escape character... an ASCII equal sign (decimal value 61) must be represented by =3D
  80. [en.wikipedia.org...]
  81. So it looks like changing all of the = to =3D should work (in theory, I haven't tested it). What's the preferred Content-Transfer-Encoding for email, though, if not "quoted-printable"?
  82. i thought it might be related to encoding - still don't understand why it would try to decode something that wasn't hexadecimal digits.

comments powered by Disqus