繁体   English   中英

从表单 Laravel 向用户发送确认电子邮件

[英]Sending confirmation email to user from form Laravel

我有一个非常简单的前端表单,可以成功发送给自己,但我不知道如何将副本发送到用户提供的电子邮件地址。

我是否认为我需要向控制器添加一个数组以使用户通过电子邮件发送一个对象,以便我能够将其发送给他们?

我的 HMTL 表格:

<div class="tab-content">
    <div class="tab-pane" id="about">
        <div class="row">
            <h4 class="info-text"> Tell us about yourself and the project you are working on.</h4>
            <div class="col-sm-5 col-sm-offset-1">
                <div class="form-group">
                    <label><b>Contact Name</b> <small></small></label>
                    <input name="name" type="text" class="form-control" placeholder="Contact Name..." id="name" required>
                </div>
                <div class="form-group">
                    <label><b>Company</b><small></small></label>
                    <input name="company" type="text" class="form-control" placeholder="Company Name..." id="company" required>
                </div>
                <div class="form-group">
                    <label><b>Contact Number</b> <small></small></label>
                    <input name="phone" type="number" class="form-control" minlength="10" maxlength="15" placeholder="Number..." id="number" required>
                </div>
            </div>
            <div class="col-sm-5 ">
                <div class="form-group">
                    <label for="project"><b>Please tell us a little about the project you are working on</b> <small></small></label>
                    <textarea class="form-control" minlength="15" maxlength="255" name="project" rows="9" id="project" placeholder="Please enter project and building name..." required></textarea>
                </div>
            </div>
            <div class="col-sm-10 col-sm-offset-1">
                <div class="form-group">
                    <label><b>Email </b><small></small></label>
                    <input name="email" type="email" class="form-control" placeholder="email@email.com" id="email" required>
                </div>
            </div>
        </div>
    </div>

在控制器中发送电子邮件的代码:

Mail::to('builder.enquiries@gmail.com')->send(new NewContactRequest($all_arrray));

任何人都可以提供的任何帮助都会很棒。

谢谢

是的,

您可以在邮件功能中添加抄送。

Mail::to('builder.enquiries@gmail.com')
    ->cc(['abc@exabc.com','def@exabc.com'])
    ->send(new NewContactRequest($all_arrray));

希望这对你有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM