html button to send email

前端 未结 8 1510
耶瑟儿~
耶瑟儿~ 2020-12-24 02:00

How do I send an email with specified initial values for the headers subject and message from a button in html, such as this



        
8条回答
  •  猫巷女王i
    2020-12-24 02:47

    You can use an anchor to attempt to open the user's default mail client, prepopulated, with mailto:, but you cannot send the actual email. *Apparently it is possible to do this with a form action as well, but browser support is varied and unreliable, so I do not suggest it.

    HTML cannot send mail, you need to use a server side language like php, which is another topic. There are plently of good resources on how to do this here on SO or elsewhere on the internet.

    If you are using php, I see SwiftMailer suggested quite a bit.

提交回复
热议问题