MCSmtpRepository.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Aug 2011 13:44:29 +0200
changeset 220 7ef561a05e48
parent 116 c1ae9aaf5d5b
child 327 36049dd8167c
permissions -rw-r--r--
added: #version_CVS

"{ Package: 'stx:goodies/monticello' }"

MCWriteOnlyRepository subclass:#MCSmtpRepository
	instanceVariableNames:'email'
	classVariableNames:''
	poolDictionaries:''
	category:'Monticello-Repositories'
!


!MCSmtpRepository class methodsFor:'as yet unclassified'!

description
	^ 'SMTP'
!

morphicConfigure
	| address |
	address := UIManager default request: 'Email address:' translated.
	^ address isEmpty ifFalse: [self new emailAddress: address]
! !

!MCSmtpRepository methodsFor:'as yet unclassified'!

basicStoreVersion: aVersion
	MailSender sendMessage: (self messageForVersion: aVersion)
!

bodyForVersion: aVersion
	^ String streamContents:
		[ :s |
		s nextPutAll: 'from version info:'; cr; cr.
		s nextPutAll:  aVersion info summary]
!

description
	^ 'mailto://', email
!

emailAddress: aString
	email := aString	
!

messageForVersion: aVersion
	| message data |
	message := MailMessage empty.
	message setField: 'from' toString: MailSender userName.
	message setField: 'to' toString: email.
	message setField: 'subject' toString: (self subjectForVersion: aVersion). 

	message body:
		(MIMEDocument
			contentType: 'text/plain'
			content: (self bodyForVersion: aVersion)).

	"Prepare the gzipped data"
	data := RWBinaryOrTextStream on: String new.
	aVersion fileOutOn: data.
	message addAttachmentFrom: data reset withName: aVersion fileName.
	^ message
!

subjectForVersion: aVersion
	^ '[Package] ', aVersion info name
! !

!MCSmtpRepository class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSmtpRepository.st,v 1.2 2011-08-20 11:44:29 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSmtpRepository.st,v 1.2 2011-08-20 11:44:29 cg Exp $'
!

version_SVN
    ^ '§Id: MCSmtpRepository.st 5 2010-08-29 07:30:29Z vranyj1 §'
! !