Welcome Guest, Not a member yet? Register   Sign In
Email form
#1

My site is live thanks for all your help.

Today I got a email that was submitted from my site.
There is link back to my site that has a bunch of random text in the Message:
-------

Name: Robertvar

Email: [email protected]

Subject: Judjfefehgje hfejfwhfjkfvjegj jefkkfejfej kfejkfekgrkhrkkgrj

Message: mysite.com teyiuwoiwfheujsmdcshflisjdalfjedbfsjhsgdhwyfeudjnfwhdgjkfbefjhdwsfjvnskhfbsjfnvshfbasnjkfbdjvgbfgjkd

--------------

I assume this is a bot, Is there any security concerns?

here is my code for the email function

Code:
public function sendEmail()
{
    helper(['form']);

    $data = [];
     
    if ($this->request->getMethod() == 'post') {
        $rules = [
          'name' => 'required',
          'email' => 'required|valid_email',
          'subject' => 'required',
          'message' => 'required'
        ];
        if ($this->validate($rules)){
            $values = $this->request->getPost(array('name', 'email' ,'subject','message'));

            $subject = $values['subject'];
       
            $email = service('email');
       
            $email->setTo('[email protected]');
       
            $email->setSubject($subject);
       
            $message = view('Contact/contact_email', [
                'body' => $values]);
       
            $email->setMessage($message);
       
            if ($email->send()) {
       
              return view("Contact/message_sent");
       
            } else {
       
              echo $email->printDebugger();
            }
        } else {
          $data['validation'] = $this->validator;
          // dd($data);
        }

    }
      return view("Contact/index", $data);
   
}
Reply
#2

(This post was last modified: 10-18-2021, 04:08 PM by includebeer.)

Yes this is probably a spam bot testing if it can abuse your email form.
You can enable the honeypot filter to trick the bots: https://codeigniter.com/user_guide/libra...eypot.html
I don't know how effective it is, but it's worth a try. You can also add some Captcha script. It's annoying for the users but it filters the junk.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB