Dont' know if this has already been reported, but the SimpleNews module:

1) ignores attachments when it is being emailed out to subscribers, and

2) embedded images do not display when emailed out.

For the first problem, I note that the latest version of mail.module can correctly email attachments, so perhaps some of the code can be pinched from that module.

For the second problem,I suspect adding a base href html statement to the email source (E.G. '') would solve the problem. Once again mail.module appears to do this correctly.

Calvin

CommentFileSizeAuthor
#8 simplenews.module62.62 KBP00595

Comments

DriesK’s picture

Category: bug » feature

Calvin, IMO this is a feature request, not a bug. Attachment and image handling are just not Simplenews features (yet). I have been thinking about whether or not to implement this though.

Do other people think this is wanted?

ejort’s picture

I've also been thinking about both of these features.

  1. I need to test but I've fixed the base href problem in my simplenews install, I'll update to the latest simplenews and see if my change to do this is easily ported forward.
  2. I noticed some code in the activeMailLib class to handle attachments. I haven't looked too hard, but if that library supports attachments it won't be too hard to add, especially as mail.module has already done this

If DriesK doesn't jump on this I'll probably develop this functionality in the next few weeks and submit some patches.

Cheers,
Eric

DriesK’s picture

Eric, you are more than welcome to jump on this and submit patches. Next week, I'm going to start working again (real work again :-)), just had 4 weeks of leave, so I won't have as much time as I have now...

Alaska’s picture

Title: Can't email attachments, and embedded images don't display when emailed. » Embedded SN Images
Category: feature » support

Have not tired an HTML newsletter with the latest SN update. But with the last version the following works fine, as least in my tests, for including an image within the body of the newsletter.

<p><img style="margin-left: 0px; margin-top: 5px; margin-right: 10px; margin-bottom: 0px; float: left; border: 1px solid black;" src="http://www.yoursite.com/subdirectory/images/mypicture.jpg" width="110" height="110">Start Your Text Here</p>

Let me know if this still works in the new version of SN.

Thanks,

Jim

DriesK’s picture

Title: Embedded SN Images » Embedded images and sending attachments
Category: support » feature

Let me know if this still works in the new version of SN.

In short: it does :-)

DriesK’s picture

Actually, I think the same goes here as for html to txt. Mail.inc could offer embedded images (which is not the same as inluding an html img-tag) and attachment handling. So again, maybe it's a waste of time to write this for use with activeMailLib, because when mail.inc is out, Simplenews is almost certainly going to use it...

ejort’s picture

Yeh, you're right that this is also functionality that mail.inc can/should include. It should be an interesting IRC chat :-)

P00595’s picture

Version: 4.6.x-1.x-dev » 7.x-1.x-dev
StatusFileSize
new62.62 KB

Hi,

I don't know much about PHP (yet), but I managed to copy bits of code from the mail module to enable embedded images and theme style support in the latest CVS simplenews module (v 1.7 2005/08/15).

I'd create a patch file to show you what I did, but I don't know how to so I've attached a copy of the simplenews.module I changed.

Regards,

Calvin

DriesK’s picture

Hi Calvin,

If you want to learn how to create patches, there is a manual on drupal.org.

I looked at your code, and I have 2 comments to make.

First, as I already wrote in this and other issues, I don't think that the Simplenews module itself should offer this kind of functionality. There should be (and will be) a separate mail backend, that should, imo, be able to handle all of this. Simplenews (and any other module that wants to send email) just hands over a fully populated node, including sending info (to/from/format/charset/encoding/...), and the mail engine takes care of it being properly send. Currently, there is a discussion going on about this on the drupal-devel@drupal.org mailing list.

Secondly, I don't see how your changes enable embedded images. As I wrote before, embedding images in an email is not the same as typing an html img tag, the src attribute simply pointing to an online image. If that's what you want: it is already possible with the current version as Alaska (Jim) pointed out in this issue.
True embedding is this: I send an email, click 'insert image' in my mail client, select an image that is stored on my local disk (an that is not available online). When the email is received, the image is 'embedded' in the email: it is not fetched from a web server.
Doing this would require a script that detects the image type (gif, jpeg,...) and sets the correct content-type, base64-encodes the image, generates a cid (content-ID), and correctly assembles this information in the email.

DriesK’s picture

A little more on why I think true embedding is important: of course, when you would create a newsletter using Simplenews, you wouldn't use an image on your local disk, but one on your web server. However, you could delete the node (and the image) later, and this would cause the image also not to be available anymore in all emailed newsletters. Or your web server could go down. Or, a lot of people using laptops, may want to read their email when they are not online (in the train,...), so if the image is not embedded, they wouldn't be able to see it. The same goes for people with dial-in internet connections (pay per minute): they connect, retrieve their mail, disconnect, and start reading.

P00595’s picture

Priority: Normal » Minor

Hello Dries,

My apologies over the confusion generated by my use of the term 'embedded image'. I agree with your description of what an 'embedded image' is and see the value in supporting it in the way you describe.

A minor point however - I don't fully believe the system can be said to already support the creation and emailing of newsletters containing HTML IMG tags. When I look at Alaska's code snippet I get the feeling he expects the newsletter authors to have the necessary HTML skills to be able to type in HTML IMG tags with fully qualified URLs for the SRC attribute.
Unfortunately the bulk of the newsletter authors I expect to be supporting have no knowledge of HTML, and will be using the TinyMCE and 'Image Assist' modules to generate the newsletters.

I may be wrong, but when I look at the URLs these tools generate for images on the server, they do not contain a domain name, thus the necessity for the system to auto generate a HTML BASE REF tag when the newsletters are emailed out. And likewise, all the style sheet references need to be auto generated.

Regards,

Calvin

PS: I also managed to add support for emailing attachments to your SimpleNews module, however I won't upload the code knowing that you are working on a better architectured solution.

DriesK’s picture

I may be wrong, but when I look at the URLs these tools generate for images on the server, they do not contain a domain name, thus the necessity for the system to auto generate a HTML BASE REF tag when the newsletters are emailed out.

You're not wrong at all. I get you now. However, if we implement embedding, the issue will be solved anyway, because the mail engine would then have to deal with (Drupal) urls when it encodes the image (and possibly also with stylesheets and/or stylesheet urls).

So I suggest we wait until the mail engine is out. We'll see what it can and can't do, and then we can fill in the missing pieces specifically for Simplenews, but compliant to the mail engine's code.

beginner’s picture

When is the mail.engine coming out? Is this part of the coming 4.7?

Nice module. Looking forward to being able to create simply html newsletters....

B.

shouchen’s picture

Could we please have an update on this issue? How are things going with the mail engine / embedded images, etc?
Thanks!
-Steve

DriesK’s picture

Actually, I'm at drupalcon Amsterdam right now. We discussed mail.inc yesterday, had a small extra mailing meeting, where these issues where covered (amongst others). There will even be more discussion on this somewhere later this week. By then, there should be more clarity about mail.inc's functionality, about timeframes, and what simplenews will have to provide separately. I'll keep you informed on this page.

DriesK’s picture

See this node for updates and more information: Mail API for Drupal.

trevornz’s picture

Hi Everybody

Firstly, thanks to the developers for the very handy simplenews module.

I'm just wondering if anybody has managed to modify this module so that file attachments can be added to Newsletter sends, and if possible please could they please post a copy of their changes.

I have tried to add in the attachement code from the mail.module but with no success so far.

I'd really appreciate any help or advive on this one on this one.

I'm using Drupal 4.6

Thnaks

DriesK’s picture

Attachments will be included in Simplenews 4.7 releases. The first stable release of a simplenews 4.7 branch is expected to become available around the same time as when Drupal 4.7 is released (and this date is not yet known). Attachments will not be made available in simplenews 4.6.

Wesley Tanaka’s picture

There's a patch available which removes base href from drupal completely, and causes urls to be absolute within the server (e.g. "/drupal/node/1234" instead of "node/1234"). If this is interesting to you, you might consider adding a comment on: http://drupal.org/node/13148

wulff’s picture

@trevornz: If you enable upload.module you can attach the uploaded files by adding the following to sn_mail_send():

  if ($mail->files) {
    foreach ($mail->files as $file) {
      if ($file->list) {
        $email->Attachment($file->filepath, $file->filename, $file->filesize, $disp="attachment", $file->filemime);
      }
    }
  }

(Add it before the call to Send())

I use this solution on one of my sites and it works as intended: Files added to a simplenews node with upload.module are attached to the e-mails sent out by simplenews.

David Lesieur’s picture

#20 works well for me. But I'd recommend removing the if ($file->list) condition. I think all uploads should be attached, not just those that have been flagged to be listed in the node body.

So you'd have:

  if ($mail->files) {
    foreach ($mail->files as $file) {
      $email->Attachment($file->filepath, $file->filename, $file->filesize, $disp="attachment", $file->filemime);
    }
  }
and-1’s picture

Title: Embedded images and sending attachments » Embedding images into email body

Yes, #20 works well.

I do not understand only if it is real to embed images into email body using activeMailLib functionality?
I mean HTML+images email body (non-"attachment").
The problem for me is how to generate Only local images are allowed.. activeMailLib doesn't use "Content-ID" param that is usually
using here.

Could anyone prompt/(correct me) how to solve the problem within Simplenews?

apakuni’s picture

FYI. I dropped David's hack (#21) in SimpleNews 4.7 in at Line #1042. It did not seem to work.

sutharsan’s picture

Status: Active » Closed (won't fix)
kavi_r’s picture

Component: Code » Miscellaneous
Assigned: Unassigned » kavi_r

I am using drupal 6.4.I try to implement a image in a body field.i download tinyMCE(6.x-1.1.tar) editor.But buttons are nor displayed.
anybody help me?

betovarg’s picture

Has this issue been resolved? I downloaded the module and Im adding images as attachments, but they dont show up in the body, they show up as attachments.

Thanx!

miro_dietiker’s picture

even 3 .. or 5 years later it's the very same situation.

we need a transport (like mimemail) module that supports inline images.
then we can discuss how to support things like inline images.

meanwhile won't fix, till someone provides a clean library where we can rely on.

that's a lot of work, man.. if u have the funds, hire a dev and we're happy to see that feature!

dianacastillo’s picture

go here admin/config/services/simplenews , click edit and change emails settings to HTML

biswajit roy’s picture

Issue summary: View changes

Hi Diana,

Thanks for your comment. It's work for me.

Cheers,
B. Roy