import yagmail import os defget_id(filename): for index in range(0,len(filename)-1): if filename[index]=='1'or filename[index]=='2': print(filename[index:index+9]) return filename[index:index+9] elif filename[index]=='M'or filename[index]=='D'or filename[index]=='m'or filename[index]=='d': print(filename[index:index+10]) return filename[index:index+10]
Sub Savetheattachment() Dim olApp AsNew Outlook.Application Dim nmsName As Outlook.NameSpace Dim vItem AsObject Set nmsName = olApp.GetNamespace("MAPI") Set myFolder = nmsName.GetDefaultFolder(olFolderInbox) Set fldFolder = myFolder.Folders("homework") ForEach vItem In fldFolder.Items '-----Save Attachment------ ForEach att In vItem.Attachments att.SaveAsFile "D:\temp\" & att.FileName Next '------Save Attachment------- Next Set fldFolder = Nothing Set nmsName = Nothing EndSub