SimpleForms is not sending any emails. I turned off the test mode, and did not change the mail settings in the config.yml file:
# by default, mail is sent using PHP's built-in mail function. In general, it's advised to use SMTP for sending mail
# instead. Uncomment the following lines to use an SMTP server with authentication.
# Please check http://silex.sensiolabs.org/doc/providers/swiftmailer.html for a full range of options
#mailoptions:
# host: localhost
# port: 25
# username: username
# password: password
# encryption: null
# auth_mode: null
So bolt should use PHP's mail function. On the same server I have several Drupal installations sending emails correctly. The error log doesn't contain anything relatied to mails.
What am I doing wrong? And are there any logs from bolt?
Edit: My simpleforms.bolt.yml:
[...]
recaptcha_enabled: false
recaptcha_public_key: ''
recaptcha_private_key: ''
recaptcha_error_message: "The CAPTCHA wasn't entered correctly. Please try again."
recaptcha_theme: clean
csrf: true
from_email: [...]
from_name: Anonym
testmode : false
testmode_recipient: [...]
contact:
recipient_email: "[...]"
recipient_name: "[...]"
mail_subject: "[...]"
button_text: "Senden"
fields:
name:
type: text
required: true
placeholder: Ihr Name
label: Name
email:
type: email
label: E-Mail-Adresse
required: true
placeholder: Ihre E-Mail-Adresse
subject:
type: text
required: true
placeholder: Betreff Ihrer Nachricht
label: Betreff
message:
type: textarea
required: true
placeholder: Ihre Nachricht
label: Nachricht
As I didn't get the extension to work by myself, I finally asked on the IRC channel. I was told that the documentation is wrong. Bolt always uses Swiftmailer for sending mails even if "mailoptions" is commented-out completely.
By default Swiftmailer does not output much information. That's why I always got a success message on sending, but nothing happened. As Bolt version 2.1 already is in feature-freeze, the Swiftmailer output is improved not until version 2.2.
I now configured my mailoptions according to the "phpinfo()" information (simply using "localhost" and "25" as "host" and "port") and then got the form sent correctly.
I had the same issue with mail not being sent.
Then I ran into the config.yml of the latest version which says, to enable your notifications in your form:
notification:
enabled: true
debug: false
debug_address: name#example.com # Email address used when debug mode is enabled
debug_smtp: true
Related
I'm connecting to a MySQL database for OTP using this gramex.yaml configuration:
otp:
url: 'mysql+pymysql://$USER:$PASS#$MYSQL_SERVER/$DB'
table: $TABLE
Whe Gramex starts, it reports an Exception:
InternalError: (pymysql.err.InternalError) (3159, 'Connections using insecure transport are prohibited while --require_secure_transport=ON.')
This answer suggests passing a dummy ssl: dict.
How do I pass this to Gramex's FormHandler?
There are 2 possibilities. If you don't have an SSL certificate to connect to the database, use:
otp:
url: 'mysql+pymysql://$USER:$PASS#$MYSQL_SERVER/$DB'
table: $TABLE
connect_args:
ssl:
fake_flag_to_enable_tls: true
If you have an SSL CA certificate in a PEM format, use:
otp:
url: 'mysql+pymysql://$USER:$PASS#$MYSQL_SERVER/$DB'
table: $TABLE
connect_args:
ssl_ca: /path/to/ca-certificate.pem
You may pass any other parameter to the pymysql connection object.
I created an API Gateway which uses the x-google-backend to a cloud functions.
When I tried to access it via browser I received a CORS error so I researched and find a solution by adding this to the OpenAPI config where the address part is the same as the cloud function.
options:
operationId: cors
x-google-backend:
address: https://europe-west3-myproject.cloudfunctions.net/api/query
responses:
'200':
description: A successful response
This works! So I removed the public access to the cloud function and gave the gateway service account access to it and tried again.
Which gave me a permission error. After research I found this post explaining the problem and giving me a solution to fix it.
The issue was that I call my define the cloud function with an additional path to call query. I added this to the OpenAPI config:
jwt_audience: https://europe-west3-myproject.cloudfunctions.net/api
So I tried it again in Postman and it works, however in the browser I now get again a CORS error.
So now I am at square one... what should I do?
Here is my complete OpenAPI config:
# openapi2-functions.yaml
swagger: '2.0'
info:
version: 1.0.0
schemes:
- https
produces:
- application/json
paths:
/query:
post:
operationId: api
parameters:
- in: "body"
name: "message"
schema:
$ref: '#/definitions/messasge'
x-google-backend:
address: https://europe-west3-myproject.cloudfunctions.net/api/query
jwt_audience: https://europe-west3-myproject.cloudfunctions.net/api
x-google-quota:
metricCosts:
"read-requests": 1
security:
- api_key: []
responses:
'200':
description: A successful response
schema:
type: string
options:
operationId: cors
x-google-backend:
address: https://europe-west3-myproject.cloudfunctions.net/api/query
responses:
'200':
description: A successful response
securityDefinitions:
# This section configures basic authentication with an API key.
api_key:
type: "apiKey"
name: "key"
in: "query"
x-google-management:
metrics:
# Define a metric for read requests.
- name: "read-requests"
displayName: "Read requests"
valueType: INT64
metricKind: DELTA
quota:
limits:
# Define the limit or the read-requests metric.
- name: "read-limit"
metric: "read-requests"
unit: "1/min/{project}"
values:
STANDARD: 100
definitions:
chatmessage:
type: "object"
properties:
id:
type: string
description: session id
example: "2vr34524tg3"
query:
type: string
description: message
example: "Hello"
required:
- id
- query
According to the documentation Cross-Origin Resource Sharing (CORS) on Cloud Functions has some limitations:
CORS preflight requests are sent without an Authorization header, so they will be rejected on all non-public HTTP Functions. Because the preflight requests fail, the main request will also fail.
To overcome this limitation in your case the mentioned documentation recommends to deploy a Cloud Endpoints proxy and enable CORS. Also you might find useful the Support CORS documentation page for a description of available CORS support options
I am using Yandex Connect (SMTP) as a method to send emails from my Rails 5 JSON API app.
Here's the setup:
Rails.application.configure do
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: 'smtp.yandex.com',
port: 25,
domain: ENV['MAIL_DOMAIN'],
user_name: ENV['MAIL_USER'],
password: ENV['MAIL_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true
}
end
I also have config.action_mailer.default_url_options = { host: ENV['MAIL_DOMAIN'] } set in my application.rb
On heroku with the right credentials it works just fine. But when I try to run the same config localy and send an email, I get ArgumentError - SMTP-AUTH requested but missing secret phrase.
What could be wrong
1) Make sure the environment variables are really there, e.g. bundle exec rails console, puts ENV.inspect
2) Make sure the credentials are correct
3) Restart your development server after you've modified your environment. This includes spring stop.
I created user and gave him only one role.(Member)
Currently this role doesn't have any permission with any Http verb nor path.
This is my user:
{
organizations: [1]
0: {
website: ""
description: "AREAS"
roles: [1]
0: {
name: "Member"
id: "09dc1bdba42c48de9e15e88816284cbc"
}-
-
enabled: true
id: "363ac390cfc94aa293e02547afa78256"
domain_id: "default"
name: "AREAS"
}-
-
displayName: "root"
roles: [0]
app_id: "aea8f4a70b87422cb48068db9f0c6aea"
email: "root"
id: "root"
}
Now, when i try to do GET request on address: http://localhost/parameters/search_tables/
for which this user don't have permission,
it allows me access and redirects me nonetheless.
This is log from pep proxy:
2015-11-13 14:55:53.446 - INFO: IDM-Client - Checking token with IDM...
2015-11-13 14:55:53.484 - INFO: AZF-Client - Checking auth with AZF...
2015-11-13 14:55:53.484 - INFO: AZF-Client - Checking authorization
to roles [ '09dc1bdba42c48de9e15e88816284cbc' ] to do GET
on parameters/search_tables/ and app aea8f4a70b87422cb48068db9f0c6aea
2015-11-13 14:55:53.508 - INFO: Root - Access-token OK. Redirecting to app...
Refused to set unsafe header "accept-encoding"
Refused to set unsafe header "cookie"
My config file regarding authorization is:
config.azf = {
enabled: true,
host: '192.168.4.180',
port: 8080,
path: '/authzforce/domains/afb096b2-8951-11e5-980f-6bf3c4dac98a/pdp'
};
config.public_paths = [];
config.tokens_engine = 'oauth2';
My Pap policy is:
<PolicySet PolicySetId="default" Version="1.0"
PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.1:policy-combining-
algorithm:ordered-permit-overrides">
<Target />
<Policy PolicyId="permit-all" Version="1.0"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.1:rule-combining-
algorithm:ordered-permit-overrides">
<Target />
<Rule RuleId="permit-all" Effect="Permit" />
</Policy>
</PolicySet>
How should i formulate my PAP policy to enable authorization level2, to use only http verb and resource path for authorization?
By default, Authzforce PAP permits all when no policy is added. Check if your PAP has the right information:
GET
/domains/{domainId}/pap/policySet
Edit 1:
In order to be able to connect with Authzforce, you need to configure some Authzforce parameters into your IdM instance:
ACCESS_CONTROL_URL at fiware-idm/horizon/openstack_dashboard/local/local_settings.py
and
ACCESS_CONTROL_MAGIC_KEY at fiware-idm/horizon/openstack_dashboard/local/local_settings.py
Then, just go to IdM, and check that the permissions and roles are well configured. Sometimes, you have to 'trigger' the policy generation in IdM by going to your application -> manage roles and just click 'save' to trigger the XACML generation.
I am working on a symfony 2.2 project Site in which I am using swift mailer for sending the mail ;
In Parameter.yml , configuration is as follows:
database_driver: pdo_mysql
database_host: localhost
database_port: null
database_name: My_Project_Name
database_user: username
database_password: userpass
mailer_transport: gmail
mailer_host: smtp.gmail.com
mailer_encryption: ssl
mailer_auth_mode: login
mailer_user: my_user_name#gmail.com
mailer_password: my_gmail_account_password
locale: en
secret: my_secret
database_path: null
and my mailer is as follows:
$message = \Swift_Message::newInstance()
->setSubject("Subject_description")
->setFrom("my_user_name#gmail.com")
->setTo("destination_email#maildomain.com")
->setBody("message_body");
$this->mailer->send($message);
It's working perfectly in localhost but when project site is live on AWS-EC2 server ,it is giving no error and giving the notification message about successes fully sending the mail but in actually no email is being received on destination_email#maildomain.com. I do't know what configuration is wrong with me ?
If any body has idea about this problem please let me know , it will be very much appreciated !
After extracting my mind through many help links i finally found the solution as given below :
# app/config/parameter.yml
swiftmailer:
transport: smtp
host: email-smtp.us-east-1.amazonaws.com
username: AWS_ACCESS_KEY
password: AWS_SECRET_KEY
encryption: tls
port: 25
and in Mailer :
$renderedLines = explode("\n", trim($renderedTemplate));
$subject = $renderedLines[0];
$body = implode("\n", array_slice($renderedLines, 1));
$transport = \Swift_SmtpTransport::newInstance( 'email-smtp.us-east-1.amazonaws.com',
25,
'tls')->setUsername('aws_key')->setPassword('aws_secret');
$innerMailer = \Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance()
->setSubject('My_Project_Title_Subject')
->setFrom(array('my_mail#domail.com' => 'Reference Name'))
->setTo("destination_mail#domail.id")
->setBody($body, 'text/html');
$innerMailer->send($message);
It's working finally !
hopes it will help someone !