External SMTP for Email Sending
This guide has been reviewed and reformatted for Ruk-Com Cloud PaaS. Screens may vary slightly by platform version.
Click or tap a screenshot to view it at its original size.
Objective
This guide explains how to use External SMTP for Email Sending on Ruk-Com Cloud PaaS, with ordered procedures and practical verification points.
Before you begin
- Sign in with an account permitted to manage the relevant environment.
- Confirm the target environment, region and resources before saving changes.
- Create a backup or rollback plan before changing a production system.
SMTPSimple Mail Transfer Protocol is a standard for sending and receiving email over Internet Protocol (IP) networks. Communication between sender and receiver is via command strings and data is transmitted over a reliable data stream channel, usually a TCP connection. In this guide, we will show you how to send email via SMTP using our PHP hosting. Here's how to set it up:
PHPMailer for sending emails
PHPMailer is a full-featured native email sending solution for PHP. It is available with PHP v. 5.0 or higher.
1. Log in to Ruk-Com Cloud.
2. CreatePHP environmentClick on the New Environment button and select the PHP tab.
3. Select the server application.Apacheand set cloudlets limits, then openpublic IPFor the apache node, enter a name for your environment (e.g.phpmailer) then clickCreate
4. Click the link to download.PHPMailer script
5. Go toDeployment managerandUploadPackage to Ruk-Com Cloud Dashboard
6. Press the Browse button, select a file on your device and press the button.Upload
7. When the file has been uploaded, press the button.DeployGo to the previously created environment.
8. Then click the buttonConfignext to your server application and open the file./var/www/webroot/ROOT/config.php
9. Specify all the necessary information to configure sending emails through localhost or through the email account you want to send to:
Localhost transmission
You can send emails directly from your app without specifying your real email. In this case there are no restrictions on the frequency and quantity of emails sent. But it can detect your email sending as spam.
For configuration, you should specify parameter values as follows:
- host: specify the localhost value
- auth: Specifyfalse(Disabled authentication as it is not required for localhost)
- username: Enter your desired name (sender name)
- addreply: Specify the email address to be used for your email replies. (This parameter is required to specify a value.)
- replyto: Specify the same email as the addreply parameter.
Press the buttonSaveto save changes After that you can click the button.Open in Browsernext to your environment to see the form for sending email.
Enter information for testing, send email and clickSubmitIn no time an email will appear in your inbox.
More:If you don't receive an email Please check your spam folder.
Sending email through a real account
In case you have a special email account registered for your mailing can be used as well. Accounts like this won't end up in the spam folder, but they will have some limitations. such as the number of emails that can be sent In this example we will usegmail.com
You can configure it like this:
- host: statessl://smtp.gmail.com
- port:465(The port for your email provider, in this case gmail)
- username:Specify the email account you want to use.
- password: Specify the email account password.username
- addreplyandreplyto: Specify the same email account asusername(The account you want to send mail from)
Press the buttonSaveTo save changes click the button.Open in Browsernext to your environment
Enter information in the fields and clickSubmitThis email will appear in your inbox shortly.
Using custom forms for sending emails
You can prepare your email sending form code and set it up for sending emails.
1. Press the buttonConfignext to your Apache server.
2. Go to the folderwebroot/ROOTThen create a new file likemailtest.php
3. Paste your form code into the created file and press the button.Save
You can use this example:
<form method=POST ation=#>
From <input type=text name=from><br />
To <input type=text name=to><br />
Subject <input type=text name=subj><br />
Type your message <input type=text name=text><br />
<input type=submit name=sub value=Send>
</form>
<?php
if ($_POST['sub']){
system ("echo {$_POST['text']} | mail -s {$_POST['subj']} -r {$_POST['from']} {$_POST['to']}");}
?>
4. Click the buttonOpen in Browserto your environment and add the file name to the end of the URL. You will see a form like this.
5. To send email, you can use both localhost and your real email account (just type “localhost” or your desired email in the From field). After filling in all fields, press the button.Send
After that you will receive an email.
Note:If you don't receive an email Please check your spam folder.