-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renaming attachments not working #35
Comments
On Windows, you may need to format the filepath as such:
Can you try that out and report the result? |
I just tried it with the new filepath format and it has the exact same outcome:
I will boot up a Vagrant instance with Ubuntu to see if this problem exists only on Windows based machines. And the results are in: Unfortunately I get the same results again:
|
I had some spare time so I decided to dig into the code myself. In Pull Request #29 you posted the following code example for making use of the ability to rename attachments: # First, instantiate the SDK with your API credentials and define your domain.
$mg = new Mailgun("key-example");
$domain = "example.com";
# Now, compose and send your message.
$mg->sendMessage($domain, array('from' => 'bob@example.com',
'to' => 'sally@example.com',
'subject' => 'The PHP SDK is awesome!',
'text' => 'It is so simple to send a message.'),
array(array('filePath' => '@/receipts/customer892374892.pdf',
'remoteName' => 'Receipt.pdf'),
array('filePath' => '@/taxforms/IRS/1099.pdf',
'remoteName' => 'IRS-1099.pdf'))); The above will not work because of the missing "attachment" array. If you change the code example to the one below, it will work as expected. # First, instantiate the SDK with your API credentials and define your domain.
$mg = new Mailgun("key-example");
$domain = "example.com";
# Now, compose and send your message.
$mg->sendMessage($domain, array('from' => 'bob@example.com',
'to' => 'sally@example.com',
'subject' => 'The PHP SDK is awesome!',
'text' => 'It is so simple to send a message.'),
array("attachment" => array(
array('filePath' => '@/receipts/customer892374892.pdf',
'remoteName' => 'Receipt.pdf'),
array('filePath' => '@/taxforms/IRS/1099.pdf',
'remoteName' => 'IRS-1099.pdf')))); I took a look at the tests and I noticed that for testing the attachments you always use the MessageBuilder class, which does in fact work correctly. Are there any plans to add tests for attachments without MessageBuilder? |
@travelton Could you please confirm this? |
@Bogardo Yes. However, Message Builder is simply building an array of arrays. So, given that the array of attachments is formatted properly, you should be able to include them without using Message Builder. With that said, they should be tested. |
Closing this issue now, the tests will be included in the next version. |
using the same code for attachments, i am getting error lik array('attachment' => array( |
I haven't been able to send attachments using the new method to rename the attachments.
Here is the test code I used:
After running the above I only receive the first two emails.
Here are the results per version/mail:
The text was updated successfully, but these errors were encountered: