Skip to content
Advertisement

How to generate a temporary email for use in a web-application?

Example: if I want to upload a video to some video service website (such as Youtube) by email, I can send a video to an email address (e.g 1234567890@upload.youtube.com). The number is an upload code – It’s a unique number and changes every time. Then Youtube will process and upload my video automatically.

How did they create the email address 1234567890@upload.youtube.com, and how did they process an email message that a user has submitted?

I’m looking for the basic functionality behind this kind of web-application.

Advertisement

Answer

I’ve never done this, but I have a basic idea of how this is done. There’s a mail server on upload.youtube.com waiting for any email no matter who’s the recipient.

Once it gets a message it will pipe it to a script which can parse it and get the recipient address (that’s the uploader’s unique identifier).

Then it will look in the email for the attachment and get MIME code, base64-decode it and then write it to a file on a disk.

Then it will add an entry in the database with the user’s unique identifier and the link to that uploaded content.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement