West Ham will face Romanian side Astra Giurgiu in the Europa League play-off round.
The Hammers were knocked out of the competition by the same team in the third qualifying round last season.
Slaven Bilic’s men progressed to this round with a 4-2 aggregate win over Slovenian side NK Domzale.
The Premier League side travel to Romania for the first leg on 18 August before hosting the return leg at their new London Stadium on 25 August.
The draw means both English teams in European play-off ties face Romanian sides, with Manchester City drawn with Steaua Bucharest in the Champions League.
Astana (Kazakhstan) v Bate Borisov (Belarus)
FC Midtjylland (Denmark) v Osmanlispor (Turkey)
AS Trencin (Albania) v Rapid Vienna (Austria)
Arouca (Portugal) v Olympiakos (Greece)
Lokomotiva Zagreb (Croatia) v Genk (Belgium)
Vojvodina (Serbia) v AZ Alkmaar (Netherlands)
Dinamo Tbilisi (Georgia) v PAOK Salonika (Greece)
AEK Larnaca (Cyprus) v Liberec (Czech Republic)
FK Austria Vienna (Austria) v Rosenborg (Norway)
Beitar Jerusalem (Israel) v St Etienne (France)
AA Gent (Belgium) v Shkendija (Macedonia)
Istanbul Basaksehir (Turkey) v Shakhtar Donetsk (Ukraine)
FC Astra Giurgiu (Romania) v West Ham (England)
Sonderjyske (Denmark) v Sparta Prague (Czech Republic)
Fenerbahce (Turkey) v Grasshoppers (Switzerland)
Sassuolo (Italy) v Crvena Zvezda (Serbia)
Brondby (Denmark) v Panathinaikos (Greece)
IFK Gothenburg (Sweden) v FK Qarabag (Azerbaijan)
Krasnodar (Russia) v Partizani Tirana (Albania)
Maccabi Tel-Aviv (Israel) v Hajduk Split (Croatia)
Slavia Prague (Czech Republic) v Anderlecht (Belgium)
Maribor (Slovenia) v Gabala (Azerbaijan)