简体   繁体   中英

Is there a way to instantly send an e-mail using “mailto” in CSS (or any language-related to web development) without opening Outlook or Apple Mail?

I'm trying to create a personal website that has a contact form -- message box, for example -- but whenever I click submit or send, it opens up my Outlook e-mail, collects all the data I wrote down and then I have to click send again in Outlook to finally deliver that e-mail to someone. I'm new to webDev, so I'm just wondering if it's possible.

mailto: URLs are very unreliable and (when they work) always interact with the mail client on the user's machine.

Any solution involving submitting a form to a web server and sending email using server-side programming won't.

Use a server-side solution. Third-party hosted options exist if you don't want to do any server-side programming yourself.

The way to do this is to use a form to send data to your server. Your server then connects to an SMTP server to send the email.

If web pages could send emails on behalf of people without interaction, this would be used for spam.

It is not possible to directly send email from the web browser, whether it is CSS, HTML, nor Javascript.

I'm assuming that you'd like a contact page which would allow anyone visiting to fill in a small form which notifies you by email when they submit it?

unfortunately, this isn't possible using only css, html or javascript - which are the tools available to you in the web browser.

If you're willing to go a little deeper, then this is entirely possible given a server-side application. It's common to do this kind of thing in PHP, but any server-side language would be able to do this. You would need to do some set-up if you wanted to do it yourself, things like setting up a mail server to send outgoing mail. These things can be tricky. I'm sure that there are also many hosted options available, but I'm afraid I don't know of any.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM