簡體   English   中英

如何發送從輸入表單中獲取的數據,然后將它們發送到我的 email 地址,而無需打開新的 window? 我目前正在使用 angular-cli

[英]How to send data which get from the input form then send them to my email address without open a new window? I am currently using angular-cli

這是我要發送到我的 email 地址的數據。 我如何實施一種方法來實現這一目標?

 {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() { }

}

使用郵箱

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}`;
}

或者從后端發送郵件或使用外部 package

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM