如何发送从输入表单中获得的数据,然后在不打开新窗口的情况下将其发送到我的电子邮件地址?我目前正在使用angular cl



这是我想要发送到我的电子邮件地址的数据。我如何实现一种方法来实现这一点?

{Name: "John", phoneNumber: "12364597"}
Name: "John"
phoneNumber: "12364597"
__proto__: Object

import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent {
submit(f) {
console.log(f.value);

}
constructor() { }
}

使用mailto

submit(f) {
window.location.href = `mailto:mail@example.org?subject=look at this website&body=Hello Iam ${f.value.name} and here is my phone no. ${f.value.phoneNumber}`;
}

或者从后端发送邮件或使用外部包

相关内容

最新更新