Send email via curl - bash

I try to send a email via curl. and the following code dosen't work.
curl --connect-timeout 59 -v --insecure "smtps://smtp.live.com:25" -u "*****#outlook.com:*******" --mail-from "********#outlook.com" --mail-rcpt "*****#yahoo.de" -T mail.txt --ssl
Can someone tell me whats wrong? I wanna send the email via Outlook.com.

After you have added more detailed output , it looks like ssl related issue, the same symptoms are described here - cURL: Operation timed out after 0 milliseconds , hopefully this helps.

Related

Sending email using cURL with a password with special character in bash script

I have an SMTP configuration like the follows: (everything is dummy data)
SMTP_USERNAME="fakenews#yahoo.comg"
SMTP_SERVER="smtp.office365.com"
SMTP_PASSWORD='rdjsllskdslsds!'
SMTP_PORT="587"
EMAIL_FROM="support#fakernews.com"
EMAIL_TO="rfakeuser#fakernews.com"
Note the "!" mark at the end of the password. This cannot be changed.
When I run the below command with everything hardcoded, it works fine, and an email is sent.
curl --url smtp://smtp.office365.com:587 --mail-from support#fakernews.com --mail-rcpt rfakeuser#fakernews.com --upload-file tempemailbody_1.txt --user fakenews#yahoo.comg:rdjsllskdslsds! --ssl
However, when I replace them with variables, as below, I keep getting access denied.
curl --url "smtp://$SMTP_SERVER:$SMTP_PORT" --mail-from $EMAIL_FROM --mail-rcpt $EMAIL_TO --upload-file tempemailbody_1.txt --user "$SMTP_USERNAME:$SMTP_PASSWORD" --ssl
The error message is :
curl: (9) remote access denied: 501
I think that this is because somehow the variable interpretation is causing the issue, but I cant figure out what is it. What should I change in the command to make it work ?

Jira API GET all users from Jira project with specific status

In my Ruby app I'm trying to get all agent users from my service desk board. It means all users with status: 'ServiceDesk'. Is it possible using only base auth?
In curl I was trying something like:
curl -D -u USERNAME:PASSWORD -X GET -H "Content-Type: application/json" https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK
But all what I get is an error:
Warning: The file name argument '-u' looks like a flag.
curl: (3) URL using bad/illegal format or missing URL
{"errorMessages":["Internal server error"],"errors":{}}%
Is there any way to get those data with basic auth?
I think there's an issue with the curl command, try this
curl -D- -u USERNAME:PASSWORD https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK

jenkins pipeline. curl get works but post doesn't

I'm running Jenkins pipeline job on a windows 10 agent.
i'm trying to publish some information from the agent to confluence.
Running with script.bat:
curl --fail --silent --show-error -u ****:**** -X GET <SomeInternalAddress>
works!
but running:
curl --fail --silent --show-error -u ****:**** -X POST -H 'Content-Type: application/json' -d '#tmpCurlPostData.txt' <SomeInternalAddress>
results with:
curl: (6) Could not resolve host: application
curl: (22) The requested URL returned error: 415
tried escape a '=' in the password with '^'. tried surrounding with quotes.
but with no success.
interesting fact, the same code works fine on win 7,
testing it on a new win 10 machine revealed the problem.
would appreciate any idea guys.
thanks a lot!

Splunk API not working with cURL using port 8000

I'm trying to login on my local Splunk server using curl bash command but without success, so far I have tried the following:
curl -u admin:changeme -k http://192.168.1.103:8000/en-US/account/login
curl -u admin:changeme -k http://192.168.1.103:8000/en-US/account/login -d"username=admin&password=changeme"
Any help would be very appreciated,
Thanks.
Are you trying to do REST calls? You need to hit port 8089

Different body for same Curl request sent from Windows and Ubuntu

I'm trying to send a curl request from both Windows and Ubuntu system to a Rest API. following is the request
curl -k -X POST http://172.16.76.1:8080/test -d 'sample_param={"user_info":{"name":"abc","age":"20"}}'
When I read this from the server side, I get the following two different content data from each OS
Body for curl request from Ubuntu:
sample_param={"user_info":{"name":"abc","age":"20"}}
Body for curl request from Windows:
sample_param={user_info:{name:abc,age:20}}
(Note that double quotations are missing)
As a result I cannot get the json object from the request.
Can someone point out the mistake and give a solution for this.
Thanks in advance
Changing the curl command to following worked
curl -k -X POST http://172.16.76.1:8080/test -d "sample_param={\"user_info\":{\"name\":\"abc\",\"age\":\"20\"}}"

Resources