sp_send_dbmail not sending Email when row inserted from Website - triggers

I have a table in which if row is inserted I send a notification email. It works fine if I insert a row manually using SQL Server Management Studio, but fails if I insert a row from Web Interface. Jsut can't figure out why it would fail with insert from web UI? Here's the code for sending email:
exec msdb.dbo.sp_send_dbmail
#profile_name = 'ABC',
#recipients = #to,
#subject = #subject,
#body = #body

I figured out the solution. The problem was with Profile settings of database mail. The profile I was using was set as Private. So the process that was adding row to the table via website did not have permission to use database mail. I couldn't figure out under which id changes were made to the database via UI. But I created a public profile and used that to send email.

Related

How to recieve email from Contact Us from written with Flask

I just created a Contact Us form using Flask. The code seems to work correclty as explained in many tutorials like this one: link.
The reason why it all works it is because at the beginning of the app file I need to insert the username and password of the person who is sending the mail (in this case it's me) through the form:
mail = Mail()
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = 'my_personal_email0#gmail.com'
app.config["MAIL_PASSWORD"] = 'my_personal_password'
mail.init_app(app)
However once my website will be hosted online in some server, whoever wants to contact me trhough the form will just have the option to insert his email in the form and of course no password. Here it is what it looks like:
                               
Would you be able to explain how this situation is handle once I host the website in some server? Is there something wrong with my logic?
You can do 2 things here
You need to store the details in the database and make an admin panel to view the details from the database
Create a fake Gmail and let that Gmail send you the users name, email subject, and message
I personally prefer the 1st option

google sheets email script not runnable by all shared people

I have a google sheet shared with other people (I'm the owner) and in it there is a button linked to a corresponding bundle script that send me an email when the user logged press that button (so if I click the button I send an email to me).
All the other people have the "edit" privileges but when they click the button an error occurs saying that it's impossible to send the mail (when I click all works perfectly).
The accounts associated to the other people has the same email domain of mine (not gmail, but related to the same company).
It seems like that the script has different privileges because I have no problem, while the other people do.
As normal, at the first time they click to the button they (but also me) had to accept the google authorization to "send email as you" (as the avatar of the current account logged).
This is the code of the button:
'''
var sheet = SpreadsheetApp.getActiveSheet();
var sel = sheet.getSelection();
var sel_range = sel.getActiveRange();
var message = sel_range.getValues();
// get task IDs
var prev_values = sel.getNextDataRange(SpreadsheetApp.Direction.PREVIOUS).getValues();
var cod_tickets = [];
for (var k in prev_values){
cod_tickets.push(prev_values[k][0]);
}
var emailAddress = SpreadsheetApp.getActive().getSheetByName('Manager').getRange('I2').getValue();
var subject = 'ticket ' + cod_tickets;
MailApp.sendEmail(emailAddress, subject, message);
'''
I say that they send an email to me, because the "emailAddress" variables will be filled with the value of the cell that contains my email address.
Any ideas?
Have a look at the documentation for restrictions for simple triggers:
They cannot access services that require authorization. For example, a
simple trigger cannot send an email because the Gmail service
requires authorization, but a simple trigger can translate a phrase
with the Language service, which is anonymous.
Solution:
Use an installable trigger instead.
Go to Edit->Current Project's trigger
Click on +Add trigger
Select event type On edit.
Your function should no be named onEdit, because otherwise both the simple and installable trigger would fire at once which can lead to problems.
The problem:
The installable trigger will fire for every user, but it will fire on your behalf, so the email will always be you.
If this is a problem, you will need to use a service account that will impersonate the session user, which will make things more complicated.

Tigase Custom Database

I am trying to integrate Tigase to use my custom MySQL database to authenticate users, gets rosters and vCards. I setup the "Custom Authentication Connectors" as described at https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#customAuthentication however, it only seems to authenticate users I've already added to the local Tigase database. Is it possible for Tigase to automatically create the user when the user has successfully authenticated? And, how can I setup Tigase to get the user's roster and/or vCard from my custom database?
I've tried setting up the "Custom Authentication Connectors" as described at https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#customAuthentication, however, for users that only exists in my custom database, it allows login, but throws an error when I try to create a room or add a user to my roster as "tigase.db.UserNotFoundException: User does not exist" and "WARNING: NotAuthorizedException for packet."
Here is the config I am using based on https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#customAuthentication:
authRepository {
default () {
cls = 'tigase.db.jdbc.TigaseCustomAuth'
'data-source' = 'db-custom'
'conn-valid-query' = 'select 1'
'user-account-status-query' = 'select onlineStatus AS account_status from tbl_contacts where id = ?'
'user-login-query' = "select vUserId AS user_id from tbl_contacts where vUserId = ? AND vPassword = ?"
}
}
I expect to be able to integrate Tigase with my custom database so that it authenticates, gets roster and vcard information from my database.
The answer to your question: " Is it possible for Tigase to automatically create the user when the user has successfully authenticated" is actually answered in the linked documentation:
To keep user accounts in sync between the authentication database and the main user database you have to add following option to the end of the database connection URL: autoCreateUser=true
Currently it's not possible to retrieve user data from custom repository by only changing / adjusting configuration.
If you want to completely manage the users using your own database, then you'd have to implement UserRepository interface by yourself (you may take a look at JDBCRepository implementation to get an idea how to go about that)

SQL setting href to an automated email

I am sending an automated email from SQL by creating a job which works fine, in that mail I am providing a link to give feedback which I framed as follows
DECLARE #Url NVARCHAR(MAX) = '<a href="http://myserver/Feedback"
target="popup" onclick="window.open(''http://myserver/Feedback'', ''popup'', ''width=600,height=600''); return false;"> Feedback </a>'
But when it comes to mail it is always opening in a new tab instead of popup. This is what I seen when I view source of it
Feedback

Configurating JOOMLA's e-mail notification for new account

I'm using Joomla 1.5 to create a local site for my office. The site will be accessed locally via intranet, and my PC will be the localhost for the site.
I'm using a Login pluggin, so that anyone who wanted to enter the site should create an account.
In JOOMLA, all user who created their account for the first time will receive a notification e-mail like :
"Hello pras,
You have been added as a User to Information Center by an
Administrator.
This e-mail contains your username and password to log in to
http://localhost/yaddayadda/
Username: hadisuryo.prasetio Password: xxxx
Please do not respond to this message as it is automatically generated
and is for information purposes only."
but if the user click the URL in the mail, which is, "localhost/yaddayadda/" they will not be directed to my site, but to their own PC's localhost....
My question is : How can I Modified the e-mail or the site configuration so that the URL will not be "localhost/yaddayadda/" anymore, but will be "(My-IP address)/yaddayadda"
I'm not going to host my site to a web hosting service, just using my PC as a host.
I've been trying to trace on each config and .ini files...it seems that i have to do something with the "JURI" function or the "$mosConfig_live_site" on the backlink.php file
$mosConfig_absolute_path = JPATH_SITE;
$mosConfig_live_site = JURI :: base();
$url_array = explode('/', $_SERVER['REQUEST_URI']);
Can anyone give me assistance ?
actually what the joomla does it takes the value as $_SERVER for the host so what you have to do u just append "/yaddayadda" at the email template of the joomla
You could edit:
%SITE_ROOT%/administrator/language/en-GB.com_users.ini at around LINE 28, which reads
NEW_USER_MESSAGE=Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis e-mail contains your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only.
Be careful with the '%s' variable as it appears to insert different values in each instance. First instance renders their NAME, second SITE NAME, third one is the USER NAME, etc, etc.
-Dennis
You can find those values in root/components/com_users/models/registration.php on line 88. It appears it pulls it out of the array that is being created their.