나는 this document을 통해 읽었습니다. 대부분의 문서는 이메일의 uid를 찾는 것에 기반합니다. 기사에서 :기존 파이썬 이메일 개체의 uid 찾는 방법
"The way this works is pretty simple: use the uid function, and pass in the string of the command in as the first argument. The rest behaves exactly the same.
result, data = mail.uid('search', None, "ALL") # search and return uids instead
latest_email_uid = data[0].split()[-1]
result, data = mail.uid('fetch', latest_email_uid, '(RFC822)')
raw_email = data[0][1]
나는 이메일을 소비하는 목적있는 장고 응용 프로그램이라고 장고 사서함 (http://django-mailbox.readthedocs.org/en/latest/index.html)와 함께 일하고 있어요.
: 나는 장고의 검색어에서 레코드를 선택하고 이메일 목적으로 바꿀 수있는 파이썬 "이메일"라이브러리를 사용하여u'django_mailbox.message': {
'Meta': {'object_name': 'Message'},
'body': ('django.db.models.fields.TextField', [], {}),
'encoded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'from_header': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'in_reply_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'replies'", 'null': 'True', 'to': u"orm['django_mailbox.Message']"}),
'mailbox': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'messages'", 'to': u"orm['django_mailbox.Mailbox']"}),
'message_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'outgoing': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'processed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'read': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'subject': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'to_header': ('django.db.models.fields.TextField', [], {})
:
앱처럼 보이는 "메시지"모델을 생성
qs = Message.objects.filter("my criteria")
first = qs[0]
one = first.get_email_object() // one is an email object
db의 기존 데이터에 uid가 있습니까? 그렇다면 어떻게해야합니까?
데이터베이스 정보를 이메일 개체로 "재구성"하는 방법은 무엇입니까? 리콜하는 데이터가 직렬화 된 데이터입니까 아니면 수동으로 구축하고 있습니까? – iandouglas
자세한 내용은 업데이트 된 질문을 참조하십시오. – user61629