Using MIME with attachments (364 Views)
Reply
Occasional Visitor
Rob-Cox
Posts: 2
Registered: ‎07-20-2011
Message 1 of 3 (364 Views)
Accepted Solution

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

Please use plain text.
Regular Advisor
Toine_1
Posts: 106
Registered: ‎07-12-2009
Message 2 of 3 (358 Views)

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

Please use plain text.
Occasional Visitor
Rob-Cox
Posts: 2
Registered: ‎07-20-2011
Message 3 of 3 (353 Views)

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

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation