I use the grails mail plugin to send mail, I have to send an email from the service and from this i use the grails mail plugin: http://grails.org/plugin/mail
So I have this code:
mailService.sendMail {
async true
to 'hello#world.fr'
from 'world#hello.fr'
subject subj
body (view:'/mail/_mailTemplate')
}
So at this point everything's fine , my method send email.
In my mail template i have the image pippo.png that i have to show, and I do it in this way.
<img src="${resource(dir: 'images/mailImage', file: 'pippo.png',absolute:true)}">
In the generated html the link that i get as a result for that image is :
http://localhost/images/mailImage/pippo.png
with this link is obvious that the mail client will never find the image.
but when i render the same template from a controller i get:
http://www.mycorrectdomain/images/mailImage/pippo.png
so how can I get the current domain even when i render my template from the service?
In the grails documentation of the resource tag, it says:
absolute (optional) - If true will prefix the link target address with the value of the grails.serverURL property from Config.groovy, or localhost if there is no setting in Config.groovy and not running in production.
So, I'm guessing the reason you are seeing localhost is because you haven't configured your URL in Config.groovy, or, you are not running in production model.
To change the default URL, in Config.groovy:
grails.serverURL = "http://www.thecorrectwebsite.com"
To run in production mode: grails production run-app should do the trick.
Related
I have a static site that uses a contact form that is hosted on a fork of this repo: https://app.datafire.io/projects?baseRepo=https:%2F%2Fgithub.com%2FDataFire-repos%2Fcontact-us-base
Everything seems to be in order and it works successfully and delivers emails when I test it on Datafire, but when deployed on my site, sumbitting the form gives me the error "Path not found: POST /", so I'm not sure why I get this routing error when I try to submit it from my site.
This is the form action:
<form action="https://sub-tm.prod.with-datafire.io" method="post">
and as I said, it works when tested from DataFire.
edit: I just noticed the log on datafire shows this:
WARNING! Unable to find a Swagger path that matches "/"
It looks like your action is on the /contact endpoint. So it should work if you change the URL to https://sub-tm.prod.with-datafire.io/contact
I have a very simple PHP app that allows a User to enter names of Cities or Zip-codes into a search box, and the User gets auto-complete suggestions based on data stored in my Google CloudSQL server.
index.html - Renders a simple search box where users can enter search keys and they get auto-complete suggestions. Accomplished via Twitter's typeahead.js library (jQuery plugin).
city.php - PHP file that acts as a translation layer. Receives request from the browser and initiates connection to my Google CloudSQL server where I have a simple database with some city and zipcode data. Returns the data back to the browser as an array.
This works on my local Mac OS X Apache server. I am trying to get this setup to work on Google PHP AppEngine. I created an app.yaml file that looks like this:
runtime: php55
api_version: 2
threadsafe: true
handlers:
- url: /
static_files: index.html
upload: index.html
- url: /(.*)
static_files: www/\1
upload: (.*)
- url: /(.+\.php)$
script: \1
This is where I run into an issue. When I run gcloud app deploy from my local folder (which houses index.html, city.php, and app.yaml), I get the following message in the logs.
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[/Users/arjunshah/.config/gcloud/logs/2016.11.13/12.31.04.137587.log].
When I run gcloud app deploy with log verbosity, I see the following:
INFO: Could not find any remote repositories associated with [/Users/arjunshah/Documents/autocomplete]. Cloud diagnostic tools may not be able to display the correct source code for this deployment.
File upload done.
INFO: Manifest: [{'app.yaml': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/abbe3c7fc03eb43497686990488c54e2ae0533ea', 'sha1Sum': 'abbe3c7fc03eb43497686990488c54e2ae0533ea'}, 'index.html': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/1865620cc55de1902c2a9636df601f532cb2657a', 'sha1Sum': '1865620cc55de1902c2a9636df601f532cb2657a'}, 'city.php': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/64999cc8da06416a54be99c43e6e017aa0c1d01a', 'sha1Sum': '64999cc8da06416a54be99c43e6e017aa0c1d01a'}}]
Updating service [default]...
INFO: Previous default version [ashah-146101/default/20161113t122802] is an automatically scaled standard environment app, so not stopping it.
The index.html page loads fine, but when I try to enter names of cities (that I know are in the database), I see the following error in the Google Browser Inspect Element console.
Failed to load resource: https://ashah-146101.appspot.com/city.php?query=P the server responded with a status of 404 ()
Please help!
I'm trying to send an email using Ansible, but I can't understand how it works as I don't know how to provide user and password for such service (not specified in the documentation).
Both my machine and the email server are in the same network, but I need to be authenticated in order to send the email.
This is my yml file:
---
- name: Testing email
hosts: localhost
tasks:
- name: Send email
local_action: mail
host=mail.server.com
port=993
subject="Ansible test mail"
body="Testing email"
from=my#email
to="y#email
charset=utf8
And this is the related content of the hosts' file:
[localhost]
localhost ansible_connection=local
Any idea about how should I configure it? Thanks in advance.
Looking at the source code for the mail module ( https://github.com/ansible/ansible/blob/d1effecb2ef073e478c67a7ca39cf56708a66a48/library/notification/mail ) it doesn't look like it supports SMTP authentication.
It shouldn't be too hard to add support for it however. It would require adding the username and password parameters to the module, detecting if they've both been supplied, and if so, calling smtp.login() with those parameters.
In fact, it looks like there's two pull requests to do exactly that at the moment here
https://github.com/ansible/ansible/pull/7213
and here
https://github.com/ansible/ansible/pull/6667
So support will most likely be added in dev soon.
I use Jenkins extended email notification plugin to get an email after a build finishes...
and when i get the mail i see URL which gives the latest changes done to the build for ex:something like: <://abcd.l%20Automation%20-%20IE8%20Browser/changes>...
Instead of this i would like to see the URL in the mail which directly gives the build status
for ex: some thing like://abcd.l%20Automation%20-%20IE8%20Browser/buildnumber>...so that clicking on this URL should directly open the build status page....
is there any way we can configure with the jenkins ?
I have default content being set as below : $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.
please let me know ...
musaffir
$BUILD_URL should work.
Please check "Advanced Settings" of "Editable Email Notification" plugin in your job. You might have overridden the default settings of "Failure" trigger
I have set up the facebook plugin like the instructions.
Downloaded package and installed in app/plugins/facebook
Created app/config/facebook.php with my app's id, key and secret numbers, based on the example config file
Included $helpers = array('Facebook.Facebook') in my app_controller.php
Echoed the $this->Facebook->html() function in my layout (replcing the default html tag)
Echoed the $this->Facebook->init() function at the bottom of the layout, before
I run this code:
echo $this->Facebook->share('link');
If I go to: http://myhomepage.com it works but if I go to the same with HTTPS I just get a text share. In IE 10 and Chrome I get a Not safe content error. If I accept it it works.
How do I run it over SSL? I have bought the certificate, so it is valid and not a home-made self-signed one. I am running Cake PHP version 2.
I have tried to search the web, but I just find problems with the login function and not with the share button.
Please follow the below links for reference.
http://www.afbtemplates.com/tutorials/common-problems-facebook-secure-connections
http://developers.facebook.com/blog/post/497/
Do I need to support ssl on my site that allows login through facebook connect