想要根据用户名和主题自动处理电子邮件附件
我正在寻求有关设置电子邮件网关的建议,以便学生可以通过电子邮件向我发送作业,并且该电子邮件将被自动处理。
例如,如果 [email protected] 向我发送的电子邮件主题为“ CS208 hw1”,我会在参加 CS208 的学生列表中交叉检查学生,然后获取所有附加文件,将它们转储到该学生的 hw1 文件夹中,并回复一封电子邮件,说明收到的文件以及时间。如果学生的电子邮件存在某种格式错误,例如主题错误或文件丢失,该服务将发送一封适当的电子邮件。
我拥有对校园内 Linux 计算机的管理访问权限,该计算机可以配置为电子邮件服务器。
我当时正在考虑使用 fetchmail 和 cron 作业来一致地读取指定用户的电子邮件并使用某种脚本执行适当的响应。这听起来是个好方法吗?我欢迎更好的想法?
I'm seeking advice about setting up an email gateway so students can email me homework and the email will be processed automatically.
For example, if a [email protected] emails me with a subject of "CS208 hw1", I would cross check studenta in a list of students taking CS208, then take all the attached files, dump them in that student's hw1 folder and respond with an email stating what files were received and when. If the student's email was malformed in some way such as bad subject, or missing files, the service would send an appropriate email.
I have administrative access to an on-campus Linux machine that could be configured as an email server.
Offhand I was thinking of using fetchmail and a cron job to consistently read a designated user's email and perform the appropriate responses with some sort of script. Does this sound like a good way to go? I would welcome better ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我预计,在实践中,无论您规定的任何规则,都会有比正确处理的合格邮件更多的例外情况。您将会为手动修复和“计算机吃了我的作业”的说法而感到头疼。
由于这是 CS 200 级别的课程,因此要求他们使用某些版本控制系统,并避免使用 VCS 强加的严格结构解析自由格式电子邮件的麻烦。您的学生也将从该要求中受益。如果我 10 岁的孩子能够欣赏 Google Docs 中自动修订控制的优点,我猜你的学生可以处理 Mercurial 或 git 甚至(惊呼!)Subversion。
是的,但对于 Mercurial(大概还有 git)来说
,“存储库”是“目录”的一个奇特词,并不是旧的 VCS 模型可能让您期望的重量级 DBMSy 东西。
作为一名学生,我希望如何完成假设的作业:
您在学生存储库中放置的作业只是为了演示。由于您“拥有”Rich.unix.edu 机器,因此他们的推送变得具有权威性。您需要
hg init $student/cs208
进行操作。最后,如果存储库服务器宕机了,他们可以,
而且你仍然会有他们提交的带有时间戳的消化版本,它具有严格的格式,你可以为他们提交,或者更好的是:
I expect that in practice there will be far, far more exceptions to whatever rules you prescribe than there will be conforming mail which is properly handled. You'll be buying yourself a headache of manual fixups and "the computer ate my homework" claims.
Since this is a CS 200 level class, require them to use some version control system and save yourself the hassles of parsing free-format e-mail with the rigid structure that a VCS imposes. Your students will benefit too from the requirement. If my 10-year-old could appreciate the merit of automatic revision control within Google Docs, I'm guessing your students can handle Mercurial or git or even (gasp!) Subversion.
added in response to comment
Yes, but with Mercurial (and presumably git) "repository" is a fancy word for "directory" and is not the heavyweight DBMSy thingy that older VCS models may have led you to expect.
Here is how as a student I would expect to work on a hypothetical assignment:
The assignments in the student's repository placed there by you was just for the sake of demonstration. Since you "own" the Rich.unix.edu machine, their pushes become authoritative. You'd
hg init $student/cs208
on Rich.univ.edu for each student in the roster.Finally, should the repository server be down they could
And you'd still have a timestamped, digested version of their submission which has a rigid format which you could commit for them, or better still:
就我个人而言,我会选择带有上传对话框的页面,并且还可以列出当前文件,也许还有 FTP 服务器。电子邮件的问题在于,直到服务器超出您的范围为止,因为邮件会在途中由您自己的其他服务器处理。邮件可能会在途中丢失或更改,并非所有服务器都可以接受特定大小或类型的附件。虽然这个想法很好,但我认为它会产生比其他解决方案不太理想的解决方案,例如提到的页面或 ftp 服务器。
编辑
我更喜欢msw的方式。版本控制系统将为您省去很多麻烦和问题。
* 向 msw 致敬*
Personally, I would root for a page with an upload dialog and also the possibility to list current files and maybe an FTP server. The problem with Email is, that the transmission until the server is out of your reach, as the mail gets processed by other servers than your own on the way. Mails could be lost or altered on the way, not all servers might accept attachments of a certain size or type. Although the idea is quite good, I think it would produce a less than optimal solution than others, like the mentioned page or ftp server.
edit
I'd rather prefer msw's way. A version control system would spare you much hassle and problems.
* tips hat to msw*