question

Bruce Ganek avatar image
Bruce Ganek asked ·

Sending fax via the api is sending a blank page with a watermark

I'm in the sandbox, writing using the C# SDK. I can programmatically send a fax to the requested number but it appears with no attachment and the cover page has a watermark through it saying - "test fax using ringcentral development account"


What am I missing to transition it to the actual fax while in the sandbox environment?

Thank you.


fax
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban avatar image
Anirban answered ·

It maybe due to the reason that your attachment files are not getting attached properly.

Can you please refer the following:

https://community.ringcentral.com/questions/8336/sending-pdf-through-fax-with-c.html

and

https://developers.ringcentral.com/guide/messaging/fax/sending-faxes#c#

and see if this helps your issue

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Bruce Ganek avatar image
Bruce Ganek answered ·

Hello, thank you for your help.

I have stripped down the program to just send text as an attachment. I'm sending it from the developer's account in RingCentral to my actual Ring Central phone number on my computer.


When I send it, the cover page says I have 2 pages, but only one is coming through.


Here is my current code.

Byte[] myBytes = File.ReadAllBytes("testing.pdf");

//ar attachment = new Attachment { fileName = "testing.pdf", contentType = "application/pdf", bytes = myBytes };

var attachment = new Attachment { fileName = "test.txt", contentType = "text/plain", bytes = Encoding.UTF8.GetBytes("hello world") };

var attachments = new Attachment[] { attachment };

sendFaxMessageRequest.attachments = attachments;

sendFaxMessageRequest.coverPageText = "this is Bruce's Test";

var r = await rc.Restapi().Account().Extension().Fax().Post(sendFaxMessageRequest);


Also, will the commented out part work for sending a PDF (i.e. the content type and readallbytes) once I get attachments working.


I saw this but I'm unclear how to do it and have been unable to find a sample, can you steer me in the right direction?

---------

To send a fax you'll need to create a multipart/mixed request and add each PDF as an attachment. You can either send the raw bytes or base 64 encode the file.

---------

Thank you

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered ·

Hi Bruce,

Sending fax from a sandbox account is currently broken. It is the problem as you are facing now, no attachment. I created a Jira ticket some time ago but it is still not resolved yet. Meanwhile, fax works correctly in the production environment. I will check the ticket and push for fix asap.

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Bruce Ganek avatar image
Bruce Ganek answered ·

Well, that makes me feel better that I didn't mess up.


Can you let me know the best way to send a pdf? I have the commented code in my previous email, but then saw the comment about creating a multipart and attaching the PDF, I'm not sure how to do that if that's the way I need to do it.

Since I can't check it right now until I go to production, I'm trying to make sure I'm in good shape first.


Thank you,


Bruce

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered ·

I believe that it must be as simple as this

var attachment = new Attachment { fileName = "test.pdf", contentType = "application/pdf", bytes = System.IO.File.ReadAllBytes("test.pdf") };
var attachments = new Attachment[] { attachment };
requestParams.attachments = attachments;


1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Bruce Ganek avatar image
Bruce Ganek answered ·

Sounds good, that's what I was doing, I just can't see if it is correct currently in the sandbox.

Thanks for all of your help.

Bruce

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys