[Tutor] email content-type: text/plain

Chris Hengge pyro9219 at gmail.com
Thu Nov 16 23:10:22 CET 2006


Just so you can compare...

>> msg = MIMEText.MIMEText("How are you!?")
>> email.Message.Message.get_content_type(msg)
'text/plain'

On 11/16/06, Chris Hengge <pyro9219 at gmail.com> wrote:
>
> I would start by "forcing" 'text/plain'.
> If that doesn't work maybe take a look at:
> * set_type*( type[, header][, requote]) Set the main type and subtype for
> the Content-Type: header. type must be a string in the form
> maintype/subtype, otherwise a ValueError is raised.
>
> This method replaces the Content-Type: header, keeping all the parameters
> in place. If requote is False, this leaves the existing header's quoting
> as is, otherwise the parameters will be quoted (the default).
>
> An alternative header can be specified in the header argument. When the
> Content-Type: header is set a MIME-Version: header is also added.
>
> New in version 2.2.2.
>
> *************************************************************************************************************
> Just out of curiosity, have you tested your message?
> msg = MIMEText(message)
> print get_content_type(message)
>
> or:
>
> msg = MIMEText(message, 'plain/text')
> print get_content_type(message)
> *************************************************************************************************************
>
> I'm just tossing out idea's for things I would try. I've not actually used
> this module yet.
>
>
> On 11/16/06, shawn bright < nephish at gmail.com> wrote:
> >
> > use  MIMEText(message, 'someTypeThatIsn'tPlain')  ? but type/plain is
> > what i am after.
> > i am a bit confused here. It defaults to plain, but there is not
> > anything in the message headers that say what type it is. Should i use
> > MIMEText(message, 'text/plain') ?
> >
> > thanks
> > sk
> >
> > On 11/16/06, Chris Hengge < pyro9219 at gmail.com> wrote:
> > >
> > > Not sure if I'm really helping, but I want to try for all the help
> > > I've gotten...
> > > I took this from: http://docs.python.org/lib/module-email.message.html
> > >
> > > ##############################################################################
> > > *class  MIMEText*( _text[, _subtype[, _charset]]) Module:
> > > email.mime.text
> > >
> > > A subclass of MIMENonMultipart, the MIMEText class is used to create
> > > MIME objects of major type text. _text is the string for the payload.
> > > _subtype is the minor type and defaults to plain. _charset is the
> > > character set of the text and is passed as a parameter to the
> > > MIMENonMultipart constructor; it defaults to us-ascii. No guessing or
> > > encoding is performed on the text data.
> > >
> > >
> > > #############################################################################
> > >
> > > Going off this, I'd say you need to change:
> > >
> > > msg = MIMEText(message)
> > >
> > > to:
> > >
> > > msg = MIMEText(message, 'someTypeThatIsn'tPlain')
> > > On 11/16/06, shawn bright <nephish at gmail.com > wrote:
> > > >
> > > > hey there all,
> > > > i am using the email package and the phone provider i am trying to
> > > > get a text message thru has sent me an email that says that they are looking
> > > > for a tag that says 'content-type text/plain'
> > > >
> > > > i have tried about everything i can think of to get it in there, but
> > > > everything i have tried has failed.
> > > >
> > > > here is what i have so far:
> > > > address = 'someplace at someplace.com'
> > > > message = 'some text that needs to be delivered via text message'
> > > > msg =
> > > > MIMEText(message)
> > > > msg['Subject'] = 'pivots'
> > > > msg['From'] = 'l11 at xit.net'
> > > > msg['To'] = address
> > > > server.sendmail(msg['From'],msg['To'], msg.as_string())
> > > >
> > > > any ideas ?
> > > > thanks
> > > >
> > > > _______________________________________________
> > > > Tutor maillist  -  Tutor at python.org
> > > > http://mail.python.org/mailman/listinfo/tutor
> > > >
> > > >
> > > >
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061116/1cba6e9a/attachment.htm 


More information about the Tutor mailing list