[SOLVED] Best way to configure smtp settings to send emails in phprunner 10.7 |
5/19/2022 6:48:22 AM |
PHPRunner General questions | |
A
alfonso authorDevClub member
In version 10.7 I see several ways to configure the smtp service to send emails. One of them is Use PHP mail function(notrecomended) and the other one is Use mail settings set in thephp.ini file but I don't know how it is actually done. $globalSettings["strSMTPServer"] = "localhost"; $globalSettings["strSMTPPort"] = "25"; $globalSettings["strSMTPPassword"] = ""; $globalSettings["strFromEmail"] = ""; Any idea? Thanks |
|
![]() |
Admin 5/19/2022 |
This is something that you cannot guess and your SMTP settings depend on what SMTP provider do you use be that Gmail, Office 365 etc. All email providers explain how to configure their SMTP settings and this is what you need to follow. |
A
|
alfonso authorDevClub member 5/19/2022 |
I've got it with smtp settings in Misc->Email settings. All is ok. Now I would like to use an email template with html instead of building the email content line by line with this: |
![]() |
aadham 5/20/2022 |
Hi Alfonso The best approach, for me at least, was to create a table for the mail settings, so that it can be easily modified through the app and can help using more than one mail server, if need be. The table can look like this:
I've also created another table that contains HTML templates for the different emails my app would typically send. This table can look like this:
Using a few lines of code in "After Record Added/Updated" event, you can send emails easily to whomever you wish. I hope you'll find the above useful. |
D
|
DealerModulesDevClub member 5/20/2022 |
Hi aadham and thanks for your share. This is probably the best way I have seen so far to handle emails using PHPRunner. Can you share more specifics about the "Using a few lines of code in "After Record Added/Updated" event"? Do you have a code example for the events? Thank you so much for sharing. Paul |
A
|
alfonso authorDevClub member 5/20/2022 |
Thank you so much for the idea. I agree that an example would be ideal to develop your idea |
![]() |
aadham 5/21/2022 |
In our case, a project coordinator can choose to send a notification email through the app once an employee has been assigned a task. Naturally, this needs data from the Employees, Tasks, Task Types and Task Rates tables: if($values['notify_employee'] == "1") The following handles the email message itself: $email=$values["email_qc"]; This is the Tasks Emails table which contains the different email templates:
The above code is nearly three years old now and being a non-developer, I've found PHPRunner's help files and examples as well as this forum's Tips and Tricks quite valuable and helpful when I wrote/cusomized the above to serve our needs. |
A
|
alfonso authorDevClub member 5/21/2022 |
I like it. Thanks |
U
|
ustunsoz 8/24/2022 |
Dear aadham, could you please elaborate how to use database smtp settings for multiple server settings in each sending instance. I believe your code sample shows only how to use template, not overriding the system mail configuration Thanks in advance... Please Ignore my post, I just found Sergey already answered in http://asprunner.com/forums/topic/25265-smtp-settings-in-database-mysql/ Thanks |