import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { SendEmailService } from './email.service';

@Controller('send-email')
export class SendEmailController {
  constructor(private readonly sendEmailService: SendEmailService) { }

  @Post()
  async sendemail(@Body('email') email: string,
    @Body('name') name: string,
    @Body('HosName') HosName: string,
    @Body('Password') Password: string) {

    try {
      const result = await this.sendEmailService.sendemail(email, name, HosName, Password);
      return { success: true, result };
    } catch (error) {
      return { success: false, error: error.message }
    }
  }

}
