Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to write e-mail notification after LaTex build

I want to automatically build a LaTex document (step 1) and after that send the generated .pdf file via e-mail as attachment (step 2).

STEP 1: (WORKS)

image: dme26/latex-builder:latest
pipelines:
branches:
master:
-
step:
script:
-
pdflatex
-jobname=Test Test.tex;
- pdflatex -jobname=Test Test; - ls - curl -X POST "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"Test"

 STEP 2: (ERROR)

- step: 
script:
-
pipe: atlassian/email-notify:0.4.2
variables:
USERNAME: $EMAIL_ADDRESS
PASSWORD: $EMAIL_PW
FROM: $EMAIL_ADDRESS
TO: $ANOTHER_EMAIL_ADDRESS
HOST: 'smtp.googlemail.com'
#ATTACHMENTS: 'Test.pdf' #SEND generated .pdf

1 answer

0 votes

Hi @pascal_schroeer ,

thank you for your question!

In your case, artifacts will help you to share generated pdf-file with the next steps:

image: dme26/latex-builder:latest
pipelines:
default:
- step:
name: Build the pdf
script:
- pdflatex --shell-escape Test.tex
artifacts:
- Test.pdf
- step:
name: Upload to Bitbucket Downloads
script:
- pipe: atlassian/bitbucket-upload-file:0.3.2
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
FILENAME: 'Test.pdf'
- step:
name: Send email
script:
- pipe: atlassian/email-notify:0.4.2
variables:
USERNAME: $EMAIL_ADDRESS
PASSWORD: $EMAIL_PW
FROM: $EMAIL_ADDRESS
TO: $ANOTHER_EMAIL_ADDRESS
HOST: 'smtp.googlemail.com'
ATTACHMENTS: 'Test.pdf'

Also, it's a best practice to separate build and upload/send steps.

Cheers,
Oleksandr

Hello 

Thanks for your explanation! I changed my pipeline code to your suggestion.

But there are still two open points.

  1. pdflatex has to be called twice, but you called it only once. How can I achieve this in the best way?
  2. The email sending is not working. I get the following error message: Failed to send email to $BITBUCKET_USERNAME@icloud.com. Check your configuration settings.
    Are all my email settings correct?

Best Regards!

Pascal

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

329 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you