我试图在html中做一个页面,在那里我可以有一个表单,当你按提交它发送一封电子邮件给某人与表单的输出,而无需打开电子邮件客户端,如Gmail,Outlook。
这是我的代码和我尝试
<form action="mailto:info@w3docs.com" method="post" enctype="text/plain">
<div>
<label for="name">First-Name:
<input type="text" name="name" id="name" />
</label>
</div>
<div>
<label for="sname">Surname:
<input type="text" name="surname" id="name" />
</label>
</div>
<div>
<label for="email">Email:
<input type="text" name="email" id="email" />
</label>
</div>
<div>
<label for="phone-number">Phone Number:
<input type="text" name="phone-number" id="email" />
</label>
</div>
<label for="Gender">Gender</label>
<select id="Gender" name="Gender">
<option value="" disabled selected>Select Your Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
<option value="Rather Not Say">Rather Not Say</option>
</select>
<div>
<label for="Password">Password:
<input type="text" name="PS" id="name" />
</label>
</div>
<div>
<input type="submit" name="submit" value="Send" />
</div>
</form>
1条答案
按热度按时间zlhcx6iw1#
是的,你可以发送一封电子邮件,而不需要打开像gmail和outlook这样的客户端,但你需要和smtp服务器来做到这一点。你可以得到gmail的smtp凭据,这是用户名:your-email-id@gmail.com和密码:创建一个应用程序passwsord。然后你可以通过php或python发送电子邮件使用php-mailer与以下代码
You can download php-mailer through this link https://storage.googleapis.com/aryan-rh-cdn.appspot.com/Public-Uploads/php-mailer_221120_114205.tar