Laravel Verify Email Functionality and Normal Mail Functionality

नमस्ते , 


Laravel 7  मैं  Registration Verify Email   को समझने के लिये सबसे पहले  Laravel 7  (Login, Registration, Forget Password ) आदि की  Functionality  समझते है । 

Laravel 7 मैं  Auth को Install  करके ये  Functionality काम करने लग जाती है । 

जब  Registeration करते हैं  Registercontroller  मैं  Register  method   काम  आता हैं  उसके बाद Create Method  भी  Work  करता हैं । 

सभी Email  functionality के Verification  Notification के लिये  Notification  folder मैं  EmailVerificationNotification.php फाईल का उपयोग करते हैं । 

इसी  file main एक Method हैं  toMail($notifiable) जिससे Email Message बनाया जाता हैं

अगर SendGrid Email API का उपयोग करना होता है तो इस file  मैं  SendGrid Email functionality का उपयोग किया जाता हैं जो इस प्रकार हैं ।


include('PATH/sendgrid-php/vendor/autoload.php');

$email = new \SendGrid\Mail\Mail(); 
$email->setFrom("SENDING FROM EMAIL""");
$email->setSubject($subject);
$email->addTo($user,"");
$email->addContent("text/html"$email_body);
$sendgrid = new \SendGrid('API KEY');
    try {
       $response = $sendgrid->send($email);
       } catch (Exception $e) {
       echo 'Caught exception: '$e->getMessage() ."\n";
       }





Laravel मैं Sendgrid Email API भेजने की Fuctionality

Laravel  मैं  Registeration और भी कई जगह पर Email भेजने की जरुरत होती हैं । जो की जैसा Method  काल किया गय हैं  उसके अनुसार होता हैं । 

तथा सभी मेथड मैं  SendGrid API  का उपयोग किया गया हैं  ऊपर दिये गये Code के अनुसार . 








No comments:

Post a Comment

Pages