想要根据用户名和主题自动处理电子邮件附件

发布于 2024-09-15 03:52:16 字数 500 浏览 6 评论 0原文

我正在寻求有关设置电子邮件网关的建议,以便学生可以通过电子邮件向我发送作业,并且该电子邮件将被自动处理。

例如,如果 [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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心如荒岛 2024-09-22 03:52:16

我预计,在实践中,无论您规定的任何规则,都会有比正确处理的合格邮件更多的例外情况。您将会为手动修复和“计算机吃了我的作业”的说法而感到头疼。

由于这是 CS 200 级别的课程,因此要求他们使用某些版本控制系统,并避免使用 VCS 强加的严格结构解析自由格式电子邮件的麻烦。您的学生也将从该要求中受益。如果我 10 岁的孩子能够欣赏 Google Docs 中自动修订控制的优点,我猜你的学生可以处理 Mercurial 或 git 甚至(惊呼!)Subversion。

是的,但对于 Mercurial(大概还有 git)来说

,“存储库”是“目录”的一个奇特词,并不是旧的 VCS 模型可能让您期望的重量级 DBMSy 东西。

作为一名学生,我希望如何完成假设的作业:

studenta@dorm$ hg clone https://Rich.univ.edu/studenta/cs208
$ cd cs208 ; broswer ./hw1.html
$ mkdir hw1 ; cd hw1 ; make my work files 
$ hg add * ; hg commit -m "perfect the first time!" # updates locally only
$ make lots of bug fixes
$ hg commit -m "okay really done now"
$ hg push 
# sleep, party, go to class with hangover
$ hg pull
$ browse hw2.html ; mkdir hw2 
...

您在学生存储库中放置的作业只是为了演示。由于您“拥有”Rich.unix.edu 机器,因此他们的推送变得具有权威性。您需要

  1. 为名册中的每个学生编写一个(小)脚本,以在 Rich.univ.edu 上 hg init $student/cs208 进行操作。
  2. 确定 HTTPS 还是 SSH 在您的环境中效果最佳
  3. 如果需要,可以向学生的文件中添加注释(如果需要),以便他们在下次拉动时获取这些文件
  4. 对所有交互进行管理、方便、记录的记录。
  5. 学生们在推送时得到了肯定的反馈,表明它被接受了

最后,如果存储库服务器宕机了,他们可以,

$ hg export tip | mail -s "server down; assignment done" [email protected]

而且你仍然会有他们提交的带有时间戳的消化版本,它具有严格的格式,你可以为他们提交,或者更好的是:

“Rich博士,服务器宕机了!!!”
“但
您通过电子邮件向我发送了导出,
是吗?”
“当然,先生。”
“嗯,只是
当机器恢复后按下,我
已经有你完成的证据
准时。”
“噢,天哪,里奇博士,你是
膨胀!”

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:

studenta@dorm$ hg clone https://Rich.univ.edu/studenta/cs208
$ cd cs208 ; broswer ./hw1.html
$ mkdir hw1 ; cd hw1 ; make my work files 
$ hg add * ; hg commit -m "perfect the first time!" # updates locally only
$ make lots of bug fixes
$ hg commit -m "okay really done now"
$ hg push 
# sleep, party, go to class with hangover
$ hg pull
$ browse hw2.html ; mkdir hw2 
...

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

  1. Write a (tiny) script to hg init $student/cs208 on Rich.univ.edu for each student in the roster.
  2. Figure whether HTTPS or SSH works best in your environment
  3. Add commentary - if desired - to the student's files that they'd pick up on their next pull
  4. Have a managed, convenient, logged record of all the interactions.
  5. The students get affirmative feedback at the moment of push that it was accepted

Finally, should the repository server be down they could

$ hg export tip | mail -s "server down; assignment done" [email protected]

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:

"Dr. Rich, the server was down!!!"
"But
you sent me an export via e-mail,
yes?"
"Of course, sir."
"Well, just
push when the machine is back up, I
already have proof that you completed
it on time."
"Oh gee, Dr. Rich, you're
swell!"

哎呦我呸! 2024-09-22 03:52:16

就我个人而言,我会选择带有上传对话框的页面,并且还可以列出当前文件,也许还有 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*

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文