Ad

Sending Confirmation Email To User From Form Laravel

- 1 answer

I have a very simple front end form that I am successfully sending to myself, but I can't work out how to send a copy to the users supplied email address.

Am I right in thinking I need to add an array to the controller to make the user email an object for me to be able to send this to them?

My HMTL Form:

<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 protected]" id="email" required>
                </div>
            </div>
        </div>
    </div>

the code that sends the email in the controller:

Mail::to('[email protected]')->send(new NewContactRequest($all_arrray));

Any help anyone could give would be great.

Thanks

Ad

Answer

Yes,

you can add a cc to your mail function.

Mail::to('[email protected]')
    ->cc(['[email protected]','[email protected]'])
    ->send(new NewContactRequest($all_arrray));

Hope this helps you.

Ad
source: stackoverflow.com
Ad