You are specifying the userpwd
argument incorrectly. Try:
postForm('https://api.example.com/resource.xml',
From='value',
To='value',
Body='value',
.opts=list(userpwd="username:password"))
Note: RCurl syntax is kind of idiosyncratic, so in postForm
the ...
argument refers to HTTP headers whereas in getURL
(from your previous question), the ...
argument refers to curl options. This is probably what is tripping you up.