Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Email: Body/Attachment/Body

Quote Reply
Email: Body/Attachment/Body
Hi,

Can anyone tell me if there's a way to send an email with an attachment, so that some of the body of the message is included 'after' the attachment? So for example, the outgoing email would be...


Hello,

This is the beginning of the body.

<ATTACHMENT DISPLAYED HERE>

See you later!
Sender.


I'm currently making a mail object, then using the $mail->attach function, but I'm not sure if it can do what I'm asking?

Cheers,
Regan

Quote Reply
Re: Email: Body/Attachment/Body In reply to
Hi,

No, I don't think so, unless you mean by "attachment" just having the contents of the file show up there? If it's an image, you could do it with HTML mail though.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Email: Body/Attachment/Body In reply to
Hi Alex,

Yip, it's a picture every time so I'd want the attachment(image/jpeg) displayed in the middle. Is there documentation on the html mail somewhere?

Bugger, just realised this one's in the wrong forum too. Supposed to be in Links.

Apologies.
Regan.


Quote Reply
Re: Email: Body/Attachment/Body In reply to
But this one could pass for either, =). Basically you want to do:

1. Create your mail object and set 'Content-type' => 'text/html'. In your HTML message you want to put:

<img src="cid:unique_string">

for where you want the image to show up.

2. When attaching the image, use:

$mail->attach ({
body_path => "/path/to/file",
'Content-Type' => "image/jpeg,
encoding => "Base64",
'Content-ID' => "<unique_string>"
});

and I think that should work.

Cheers,

Alex

--
Gossamer Threads Inc.