0% found this document useful (0 votes)
57 views2 pages

SMTP Configuration For PHPMailer

Uploaded by

rajand2510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views2 pages

SMTP Configuration For PHPMailer

Uploaded by

rajand2510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SMTP Configuration for PHPMailer

This guide explains how to configure and set up SMTP details in the following files:

1. admin/manage-cargo.php

2. users/payment-gateway.php

Prerequisites

Ensure you have the following:

 A valid Gmail account.

 Your Gmail password or App Passkey (recommended for security).

 Access to the mentioned files in your project.

Instructions

1. Locate the Configuration Code:

o Open the admin/manage-cargo.php and users/payment-gateway.php files in a code


editor.

2. Add Your Email Credentials:

o Replace the placeholder values in the following code snippet with your Gmail email
ID and passkey:

o $mail->SMTPDebug = 0; // Disable verbose debug output

o $mail->isSMTP(); // Use SMTP

o $mail->Host = 'smtp.gmail.com'; // Gmail SMTP server

o $mail->SMTPAuth = true; // Enable SMTP authentication

o $mail->Username = '[email protected]'; // Your email ID

o $mail->Password = 'your-gmail-passkey'; // Your Gmail App Passkey

o $mail->SMTPSecure = 'tls'; // Use TLS encryption

o $mail->Port = 587; // Gmail SMTP port

o // Sender Information

$mail->setFrom('[email protected]', 'Your Name');

o Replace [email protected] with your Gmail email ID.

o Replace your-gmail-passkey with your Gmail App Passkey.

3. Save the Changes:

o After updating the credentials, save the files.


Gmail App Passkey Setup

For security, it's recommended to use an App Passkey instead of your Gmail password. To generate
an App Passkey:

1. Go to Google Account Security.

2. Under "Signing in to Google," enable 2-Step Verification.

3. Click "App Passwords" and generate a passkey for your application.

4. Use the generated passkey in the $mail->Password field.

Important Notes

 Do not share your credentials publicly.

 Ensure the files are not publicly accessible to prevent unauthorized access.

 If testing on localhost, make sure to allow less secure apps in your Gmail settings (not
recommended for production).

 Ensure the server can connect to Gmail's SMTP (smtp.gmail.com) and port 587 is open.

Troubleshooting

If you encounter issues:

 Verify your credentials.

 Ensure your Gmail account has access to SMTP services.

 Check for firewall or network restrictions blocking SMTP connections.

You might also like