General
Showing results for 
Search instead for 
Do you mean 

Using MIME with attachments

SOLVED
Go to Solution
Occasional Visitor

Using MIME with attachments

Folks,

I am trying to use MIME to send a mail with an PDF attachment which works fine, but I want to include some text in the body of the mail, which informs the recipient of the attachment.  I can't see a way to send an existing text file with the attachment included, I always have to create a new blank file to add the attachment.  How can I add some text to the body of the mail?  See below some sample code I'm using:

 

$MIME
  new/noedit sys$login:email.txt
  add/binary file71.pdf
  save
  exit
$mail/noself/sub="Test" sys$login:email.txt smtp%"emailname@abc.com"

 

Thanks,

Rob

2 REPLIES
Regular Advisor

Re: Using MIME with attachments

Hi Rob,

 

You can do it this way.

 

Create a Text Document SYS_DAT:MIME_with_Body_Text.txt which starts with the body text.

(SYS_DAT is just a directory.)

 

$ type SYS_DAT:Mime_with_Body_Text.txt

Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

 

 Hello,

 

 In the attachment you find the info.

 ______________________________________________

 Mail from an OpenVMS Company (DO NOT REPLY)

 

 


$ I have a PDF document SYS_DAT:PDF-Document.pdf

 

Create a MIME file with the Text document and add the PDF document.

 

$ MIME
MIME> OPEN/DRAFT SYS_DAT:MIME_with_Body_Text.TXT
MIME> ADD SYS_DAT:PDF-Document.pdf
MIME> SAVE
MIME> EXIT
$

$ mail/noself/sub="Test" SYS_DAT:MIME_with_Body_Text.txt smtp%"emailname@abc.com"

$

 

No you should receive a email with body text and an attachment.



Just try it.

 

/Toine

Highlighted
Occasional Visitor

Re: Using MIME with attachments

Hello Toine,

Excellent!  Move to the front of the class, this works perfectly.  Thanks very much for your help.  Saved me a load of time trying to figure this out.

 

Thanks,

Rob