Redmine Rest API error 'Subject can not be blank' - php

I am creating issue by using kbsali redmine api, I am receiving subject can not be blank error even I am passing subject
$result=$client->issue->create([
'project_id' => 'projder',
'subject' => 'this is subject subject this is subject subject this is subject subject this is subject subject this is subject subject',
'description' => 'this is subject subject this is subject subject this is subject subject this is subje',
'assigned_to_id' => '45',
'priority_id' => $_POST['inputPriority'],
'uploads' => array(
array(
'token' => $upload->upload->token,
'filename' => $file,
'description' => 'This is my file description',
'content_type'=> 'image/png'
),
array(
'token' => $uploadoptional->upload->token,
'filename' => $optionalUpload,
'description' => 'Client Attachment',
'content_type'=> $optionalUploadType
)
)
]);
)
SimpleXMLElement Object
(
[#attributes] => Array
(
[type] => array
)
[error] => Subject cannot be blank
)

I found the solution, redmine subject field rights were not given to the user by using i was sending API request to create ticket.

Related

Creating new address on shippo gives 500 error

I am creating a new address using shippo api using test token and when i give the array of address and click create it gives me 500 error. I am doing everything according to the docs given by shippo here is my code that I am using. The request I am sending is through ajax.
require_once ABSPATH . '/shippo/shippo/lib/Shippo';
Shippo::setApiKey("test_token");
$address = Shippo_Address::
create(
array(
'object_purpose' => 'QUOTE',
'name' => 'John Smith',
'company' => 'Initech',
'street1' => '6512 Greene Rd.',
'city' => 'Woodridge',
'state' => 'IL',
'zip' => '60517',
'country' => 'US',
'phone' => '773 353 2345',
'email' => 'jmercouris#iit.com',
'metadata' => 'Customer ID 23424'
));
var_dump($address);
I am confuse that what is it that I am doing wrong or missing?

Mandrill's attachment without extension on Hotmail/Outlook.com

I guess there is a issue with Mandrill attachments x Hotmail/Outlook.com.
I can send e-mail attachments with Mandrill using base64_encode(). I am using the PHP library.
If I send an e-mail to Gmail or any other provider, the attachment looks fine. Downloading it and opening normally.
But sending to a Hotmail/Outlook.com, the attachments came with no extension/file format. By downloading, it can only be opened by adding the extension manually (for example, .pdf).
The code:
$file_data = file_get_contents($_FILES["test_file"]["tmp_name"])
$file_type = $_FILES["test_file"]["type"]
$mandrill = new Mandrill('MANDRILL_API_KEY_HERE');
$message = array(
'html' => $html,
'subject' => 'Testing',
'from_email' => 'sender#test.com',
'from_name' => 'Sender',
'attachments' => array(
array(
'name' => 'Test PDF document',
'type' => $file_type,
'content' => base64_encode($file_data)
)
),
'to' => array(
array(
'email' => 'to#test.com',
'name' => 'John Doe',
'type' => 'to'
)
),
'headers' => array('Reply-To' => 'sender#test.com')
);
$result = $mandrill->messages->send($message);
Any ideas? Is it a Mandrill or Hotmail issue?
Thanks!
I have found the solution. Gmail and other email services recognizes the type attribute as above, but Hotmail only recognizes the file type by adding the extension to the attachment name (name attribute).
For example:
'name' => 'Test PDF document.pdf',
It look obvious, but Hotmail requires it. Sharing my simple knowledge, since I received no answers.

Mandrill not showing the right Cc information

This issue really driving me crazy this past hours. Why is the email that send with Mandrill not showing the right information about the Cc email address.
So for example, I want to send email to
receiver_to_a#mail.com
receiver_cc_a#mail.com
receiver_cc_b#mail.com
When I see the email header on receiver_cc_a#mail.com. its always show no cc, and that email is send "to" receiver_cc_a#mail.com, not as cc
Is anyone having the same problem? I already try sending email in PHP with PhpMailer and also try from the PHP API from Mandrill itself but no luck.
You need to set the option preserve_recipients to true.
$message = array(
'html' => '<p>Example HTML content</p>',
'text' => 'Example text content',
'subject' => 'example subject',
'from_email' => 'message.from_email#example.com',
'from_name' => 'Example Name',
'to' => array(
array(
'email' => 'recipient.email#example.com',
'name' => 'Recipient Name',
'type' => 'to'
),
array(
'email' => 'ccrecipient.email#example.com',
'name' => 'Recipient Name',
'type' => 'cc'
)
),
'headers' => array('Reply-To' => 'message.reply#example.com'),
'preserve_recipients' => true
);

PHP reply-to error - comes up with random email not sender of contact form

I have a contact form set up on my website (done through Adobe Muse)
the email is set up to send to multiple address
One of those addresses has an auto confirmation bounce back email.
The From address is NOT the email entered in the form itself but the email associated to my Adobe I.D meaning I'm receiving ALL the bounce back emails and to others it looks like the forms are coming from a single email address not the people sending off the form on the website.
I've managed to track down the php code for the form itself but have very limited knowledge when it comes to coding.
How can I get the code to make the "from" address or the repyl-to address the same as the person filling out the forms
See below
<?php
/*
If you see this text in your browser, PHP is not configured correctly on this hosting provider.
Contact your hosting provider regarding PHP configuration for your site.
PHP file generated by Adobe Muse CC 2015.2.1.352
*/
require_once('form_process.php');
$form = array(
'subject' => 'SSUPPORT FOR EXTENSIONS TO AVOCA BEACH PICTURE THEATRE IN LAND & ENVIRONMENT COURT - DA42661/2012 Submission',
'heading' => 'New Form Submission',
'success_redirect' => '',
'resources' => array(
'checkbox_checked' => 'Selected',
'checkbox_unchecked' => 'Unselected',
'submitted_from' => 'Form submitted from website: %s',
'submitted_by' => 'Visitor IP address: %s',
'too_many_submissions' => 'Too many recent submissions from this IP',
'failed_to_send_email' => 'Failed to send email',
'invalid_reCAPTCHA_private_key' => 'Invalid reCAPTCHA private key.',
'invalid_field_type' => 'Unknown field type \'%s\'.',
'invalid_form_config' => 'Field \'%s\' has an invalid configuration.',
'unknown_method' => 'Unknown server request method'
),
'email' => array(
'from' => 'saveaseat#avocabeachpicturetheatre.com.au',
'to' => 'saveaseat#avocabeachpicturetheatre.com.au,ask#centralcoast.nsw.gov.au,Carolyn.Wesley#gosford.nsw.gov.au,Ariella.Whitelum#gosford.nsw.gov.au'
),
'fields' => array(
'custom_U262562' => array(
'order' => 1,
'type' => 'string',
'label' => 'Name',
'required' => true,
'errors' => array(
'required' => 'Field \'Name\' is required.'
)
),
'Email' => array(
'order' => 2,
'type' => 'email',
'label' => 'Email',
'required' => true,
'errors' => array(
'required' => 'Field \'Email\' is required.',
'format' => 'Field \'Email\' has an invalid email address.'
)
),
'custom_U262553' => array(
'order' => 4,
'type' => 'string',
'label' => 'Message',
'required' => false,
'errors' => array(
)
),
'custom_U262696' => array(
'order' => 3,
'type' => 'string',
'label' => 'Postcode',
'required' => false,
'errors' => array(
)
)
)
);
process_form($form);
?>
Or maybe if you add replay-to in email array, like:
'email' => array(
'from' => 'saveaseat#avocabeachpicturetheatre.com.au',
'to' => 'saveaseat#avocabeachpicturetheatre.com.au,ask#centralcoast.nsw.gov.au,Carolyn.Wesley#gosford.nsw.gov.au,Ariella.Whitelum#gosford.nsw.gov.au',
'replay-to' => 'Email for replay'
),

Mandrill and PHP not sending transactional email out

So I've made a template called 'Basic' within Mandrill. I did a test send and it looks great. I put Mandrill into test mode and used the test API key in my code. I'm just trying to get the php to send out a test transactional email, but no email gets sent. Here is the printed response I get:
Array ( [0] => Array ( [email] => amiecrutchley02#gmail.com [status] => sent [_id] => 89bfab4c3938486eb9e36564f79a3e9f [reject_reason] => ) )
So I'm really not sure why I'm not receiving anything.
Here is my code:
<?php
require_once('includes/mandrill/Mandrill.php');
$mandrill = new Mandrill('my_api_key');
$message = array(
'subject' => 'Thank You For Your Purchase',
'from_email' => 'no-reply#acq.com',
'from_name' => 'ACQ',
'to' => array(array('email' => 'amiecrutchley02#gmail.com', 'name' => 'Amie')),
'merge_vars' => array(array(
'rcpt' => 'amiecrutchley02#gmail.com',
'vars' =>
array(
array(
'name' => 'FIRSTNAME',
'content' => 'Amie'),
array(
'name' => 'LASTNAME',
'content' => 'Crutchley')
))));
$template_name = 'Basic';
$template_content = array(
array(
'name' => 'main',
'content' => 'Hi *|FIRSTNAME|* *|LASTNAME|*, your profile has been updated!'),
array(
'name' => 'footer',
'content' => 'ACQ, Copyright 2014')
);
$response = $mandrill->messages->sendTemplate($template_name, $template_content, $message);
print_r($response);
?>
a test API key is specifically designed to not send email. It's designed so you can mimic sending email, but doesn't actually send. You're also not charged for sending tests. Here's the Mandrill KB about what test mode is, and how it works: Does Mandrill have a test mode or sandbox?
Well, weird, but my test API was the problem. I tried the public API and boom! It works!

Categories