开发者

Send Email, not from my server

Is there any开发者_如何学Go widget, or similar, that i could use to send an email for me?

Something like i pass a post in some pre-defined way, this server would get it, parse it and send it to some email for me?

More of a curiosity than a valid question itself...


There's the classic formmail, a CGI script from the days of yore, which now seems to have a commercial, hosted version. Most web hosts have formmail or some variation of it installed; check the documentation for your host.


Hardly in a public way, as it would most certainly be misused by spammers within a day or two.

You can set something like it up easily using a scripting language like PHP on an own server.


Yes; it's called a server-side script.
You can do it in a couple of lines of ASP.Net. (See the SmtpClient class)

It's also called an open relay; you'll need some way to prevent it from being used by spammers.


You need server-side scripting for this, using a language such as Perl, PHP, Ruby, Python, any .Net language, or Java.

  1. Typically what happens is that your web page will send a POST message to your web server with the recipients, body, and perhaps attachments of the email as POST parameters.
  2. The server side script will parse the POST parameters and run a SMTP or IMAP session with your mail server to send the mail, and the script will pack the parameters from the POST message into that session with the mail server. This is the same kind of SMTP session that your mail client (e.g. Outlook, Thunderbird, Evolution,...) uses to talk to your mail server (e.g. Exchange, gmail, sympatico.ca,...).
  3. The server side script will then render a web page saying whether or not the mail succeeded.

You need to figure out what your web host offers as a server side scripting language. All of the major server-side languages have libraries that allow you to both parse parameters from POST messages and to run a session with your email server. I have personally used libraries from Perl and Ruby on Rails for both parsing and talking to mail servers, and they were straight-forward to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜