From fc3fec50dbef5648c54e8a30c4c67b15e8cac8c8 Mon Sep 17 00:00:00 2001 From: Arun Kumar Pandey Date: Fri, 6 Oct 2023 21:33:43 +0200 Subject: [PATCH] Portfolio --- .github/workflows/main.yml | 21 +++++++++++++++++++++ forms/contact.php | 8 ++++++++ forms/process_contact.php | 24 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 forms/process_contact.php diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e421d3d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,21 @@ +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + + - name: Configure SMTP + run: | + echo "::add-mask::$GMAIL_PASSWORD" + echo "::set-env name=SMTP_USERNAME::${{ secrets.GMAIL_USERNAME }}" + echo "::set-env name=SMTP_PASSWORD::${{ secrets.GMAIL_PASSWORD }}" + + - name: Run PHP Script + run: | + php your-script.php + env: + SMTP_USERNAME: ${{ env.SMTP_USERNAME }} + SMTP_PASSWORD: ${{ env.SMTP_PASSWORD }} diff --git a/forms/contact.php b/forms/contact.php index a28e3af..1589e71 100644 --- a/forms/contact.php +++ b/forms/contact.php @@ -32,6 +32,14 @@ 'port' => '587' ); */ + $contact->smtp = array( + 'host' => 'smtp.gmail.com', + 'username' => $_ENV['GMAIL_USERNAME'], // Use an environment variable for Gmail username + 'password' => $_ENV['GMAIL_PASSWORD'], // Use an environment variable for Gmail password + 'port' => '587', + 'encryption' => 'tls' // Use TLS encryption for Gmail +); + $contact->add_message( $_POST['name'], 'From'); $contact->add_message( $_POST['email'], 'Email'); diff --git a/forms/process_contact.php b/forms/process_contact.php new file mode 100644 index 0000000..3047ad3 --- /dev/null +++ b/forms/process_contact.php @@ -0,0 +1,24 @@ +